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
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.
Use ID's and global variables (not recommended) to identify the specific pickup.
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 );
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 );