About pickups. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: About pickups. (
/showthread.php?tid=308247)
About pickups. -
budelis - 02.01.2012
Hi peoples. I want to ask how to make 5 money pickups,and they all give me money?
Re: About pickups. -
Bakr - 02.01.2012
To create the actual pickups, you would use the
CreatePickup function. You would then use the
OnPlayerPickUpPickup callback to handle when the player enters the pickup, at which time you would use
GivePlayerMoney to give them the desired amount.
Re: About pickups. -
budelis - 02.01.2012
I know that...But i want ask,do i need create 5 variables to do that?
Код:
new Money1
new Money2
new Money3
new Money4
new Money5
Money1 = CreatePickup( ... )
...
Re: About pickups. -
Stigg - 02.01.2012
Try making something like:
pawn Код:
new MoneyPickup[5];
public OnFilterScriptInit()
{
MoneyPickup[0] = CreatePickup//blah blah
MoneyPickup[1] = CreatePickup//blah blah
MoneyPickup[2] = CreatePickup//blah blah
MoneyPickup[3] = CreatePickup//blah blah
MoneyPickup[4] = CreatePickup//blah blah
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
for(new i = 0; i < sizeof(MoneyPickup); i++)
{
if(pickupid == MoneyPickup[i])
{
new cash = random(2000);
GivePlayerMoney(playerid, cash);
return 1;
}
}
return 1;
}