SA-MP Forums Archive
Multiple pickups - Same effect - 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: Multiple pickups - Same effect (/showthread.php?tid=443779)



Multiple pickups - Same effect - Juanxz - 13.06.2013

Multiple pickups - Same effect.
Is it possible?

For example I create a pickup in each 24/7 shop and if picked up will give me the same menu.

How would it work? I was thinking naming different pickups the same name..but it didn't work out
that good for me.

Example...
shop = CreatePickup(1239,1,2,2,2);
shop = CreatePickup(1239,1,3,3,3);

Or maybe
shop = CreatePickup(1239,1,x,y,z), CreatePickup(1239,1,x,y,z);

All help is very much appreciated.


Re: Multiple pickups - Same effect - RenSoprano - 13.06.2013

pawn Код:
new shop[2]; // You declared your variables. You can put as much as you want

shop[0] = CreatePickup(.....); // First one
shop[1] = CreatePickup(....); // Second one

// ETC
You can make it with Multiple variables


Re: Multiple pickups - Same effect - IstuntmanI - 13.06.2013

pawn Код:
public OnPlayerPickUpPickup( playerid, pickupid )
{
    if( var1 == pickupid || var2 == pickupid || var3 == pickupid )
    {
        // codes for var1, var2 and var3 pickups
    }
    return 1;
}



Re: Multiple pickups - Same effect - Juanxz - 14.06.2013

Thanks both of you I'll try it out!


Re: Multiple pickups - Same effect - Gamer_007 - 14.06.2013

Quote:
Originally Posted by IstuntmanI
Посмотреть сообщение
pawn Код:
public OnPlayerPickUpPickup( playerid, pickupid )
{
    if( var1 == pickupid || var2 == pickupid || var3 == pickupid )
    {
        // codes for var1, var2 and var3 pickups
    }
    return 1;
}
Well to make it more easy, we can use a loop like below

pawn Код:
new Pickups[3];

// Under Gamemodeinit or FilterScriptInit
Pickup[0] = ...
Pickup[1] = ...
Pickup[2] = ...

then under OnPlayerPickup we can use like this

for(new i=0; i < sizeof(Pickup); i++)
{
  if(pickupid == Pickup[i])
  {
   //Your Stuff for Pickups
   }
}