Pick ups Problem.

Started by InFIdeL, May 15, 2020, 09:41 AM

Previous topic - Next topic

InFIdeL

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
I'm Kai

habi

#1
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 post by me also.

NicusorN5

Use ID's and global variables (not recommended) to identify the specific pickup.

 

=RK=MarineForce

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 );

Eva

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 );