Same pickups in one variable? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Same pickups in one variable? (
/showthread.php?tid=272882)
Same pickups in one variable? -
samtey - 30.07.2011
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?
Re: Same pickups in one variable? -
=WoR=Varth - 30.07.2011
pawn Код:
new FLoat:Deagle[2][3] =
{
{0.0,0.0,0.0},
{0.0,0.0,0.0}
};
AW: Same pickups in one variable? -
samtey - 30.07.2011
Is this the variable for the pickup?
Re: Same pickups in one variable? -
=WoR=Varth - 30.07.2011
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
AW: Same pickups in one variable? -
samtey - 30.07.2011
Ehh, ok, but why this
if I got this?
pawn Код:
new Pickup[sizeof(Deagle)];
And what's this?
pawn Код:
for(new i;i<sizeof(Deagle);i++)
Re: Same pickups in one variable? -
=WoR=Varth - 30.07.2011
Sorry but it's "Float", not "FLoat".
"new Pickup[sizeof(Deagle)];" is a variable for the pickup, this variable store integer.
"new FLoat
eagle[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.
Re: Same pickups in one variable? -
eDz0r - 30.07.2011
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;
}