SA-MP Forums Archive
Pickup!! - 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: Pickup!! (/showthread.php?tid=436951)



Pickup!! - Gamer_007 - 13.05.2013

Guys I need some help.Here is what i m thinking to create pickup with array.

pawn Код:
new pickup[20];
pawn Код:
OnGameModeInit()
{
pickup[0]= CreatePcikup...
...pickup[19]...
return 1;
}
So what i use in OnPlayerPickUpPickedUp so that i wont have to make like this

pawn Код:
if(pickupid == pickup[0])
{
}
then
if(pickupid == pickup[1])
What should i use??Something like that?

pawn Код:
public OnPlayerPickupPickedUp(playerid, pickupid)
{
for(new i=0;i<=19;i++)
{
if(pickupid == a[i])
{
//Stuffs here because i am using same function for every pickup
}
return 1;
}



AW: Pickup!! - HurtLocker - 13.05.2013

Did you try the loop to see if it works?


Re: Pickup!! - Gamer_007 - 13.05.2013

nah still not but guesing if it works.Now i need to check .Wait lemme check.


Re: Pickup!! - Calabresi - 13.05.2013

The way you wrote is correct, should work.


Re: Pickup!! - Gamer_007 - 13.05.2013

Yo, it worked.

-DELETE-