Multiple pickups - Same effect
#1

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.
Reply
#2

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
Reply
#3

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

Thanks both of you I'll try it out!
Reply
#5

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
   }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)