Same pickups in one variable?
#1

Hi @ll!

Is it possible to set a pickup X with one variable to a few spawnpoints, or does it need everytime another variable,
like new deagle1; new deagle2;

If yes, how to do more coordinates in one?
Reply
#2

pawn Код:
new FLoat:Deagle[2][3] =
{
   {0.0,0.0,0.0},
   {0.0,0.0,0.0}
};
Reply
#3

pawn Код:
new FLoat:Deagle[2][3] =
Is this the variable for the pickup?
Reply
#4

That's a multi dimensional variable for the coordinate.
For the pickup:
pawn Код:
new Pickup[sizeof(Deagle)];

for(new i;i<sizeof(Deagle);i++)
{
  Pickup[i] = Createpickup blahblahblah ......
}

public OnPlayerPickupPickup(.......forgot forgot)
{
for(new i;i<sizeof(Deagle);i++)
{
 if(pickupid/*I guess*/ == Pickup[0])
{
..........
}
return 1;
}
Untested
Reply
#5

Ehh, ok, but why this

pawn Код:
new FLoat:Deagle[2][3] =
if I got this?
pawn Код:
new Pickup[sizeof(Deagle)];

And what's this?

pawn Код:
for(new i;i<sizeof(Deagle);i++)
Reply
#6

Sorry but it's "Float", not "FLoat".

"new Pickup[sizeof(Deagle)];" is a variable for the pickup, this variable store integer.
"new FLoateagle[2][3] =" is a variable for the pickup coordinate, this variable store float.
"for(new i;i<sizeof(Deagle);i++)" this is a loop. It's a easy use to make/check multiple thing.
Reply
#7

pawn Код:
#include <a_samp>

new pickup[2];

public OnGameModeInit()
{
pickup[0] = CreatePickup(1393, 1, 0.0000, 0.0000, 0.0000, -1);
pickup[1] = CreatePickup(1393, 1, 0.0000, 0.0000, 0.0000, -1);
return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
for(new pID= 0; pID < sizeof(pickup); pID++)//To give same things to all pickups
{
if(pickupid == pickup[pID])
{
//Something Here
}
}
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)