Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: InFIdeL on May 15, 2020, 09:41 AM

Title: Pick ups Problem.
Post by: InFIdeL on May 15, 2020, 09:41 AM
I added a pickup but I need that when a player take the Pickup then if Player have enoght cash it give him a weapon
but how plz help me in thatt
Title: Re: Pick ups Problem.
Post by: habi on May 15, 2020, 11:59 AM
Use function onPickupPickedUp( player, pickup )

function onPickupPickedUp( player, pickup )
{
if(pickup.Alpha==253)
{
     if(  player.Cash > 100 )
     {
             player.SetWeapon( 26, 999 );
     }else MessagePlayer("You do not have enough cash", player );
}
}

I hope this pickup.Alpha works correctly.

When you create your pickup create it with alpha 253.
local pickup=CreatePickup( 280, Vector( -32.8, 1019.2, 13.0 ) );
pickup.Alpha=253;

see this (https://forum.vc-mp.org/?topic=7749.msg48342#msg48342) post by me also.
Title: Re: Pick ups Problem.
Post by: NicusorN5 on May 15, 2020, 07:30 PM
Use ID's and global variables (not recommended) to identify the specific pickup.

 
Title: Re: Pick ups Problem.
Post by: =RK=MarineForce on May 16, 2020, 01:22 AM
bite <- CreatePickup(366, Vector(-1195.89, 108.588, 11.1278));
function onPickupPickedUp( player, pickup )
{
  if( pickup.Model == 366 ) 
{
if(player.Cash < 500) MessagePlayer("[#00cc00] Need enough money!",player);
else{
 player.SetWeapon( 10, 999 );
MessagePlayer(" You got a Pump-Shotgun",player);
//add this if u wanat to remove pickup bite.remove(); if not work pickup.Remove();
}
}

player.SetWeapon( WEPID, ammo );
Title: Re: Pick ups Problem.
Post by: Eva on May 19, 2020, 09:22 AM
Don't forget to decash the players money ^^

Quote from: =RK=MarineForce on May 16, 2020, 01:22 AMbite <- CreatePickup(366, Vector(-1195.89, 108.588, 11.1278));
function onPickupPickedUp( player, pickup )
{
  if( pickup.Model == 366 ) 
{
if(player.Cash < 500) MessagePlayer("[#00cc00] Need enough money!",player);
else{
 player.SetWeapon( 10, 999 );
MessagePlayer(" You got a Pump-Shotgun",player);
//add this if u wanat to remove pickup bite.remove(); if not work pickup.Remove();
}
}

player.SetWeapon( WEPID, ammo );