variable question ?! - 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: variable question ?! (
/showthread.php?tid=84358)
variable question ?! -
SEC - 30.06.2009
Hey guyz,
is it possible to define a variable for more than one thing?
like this :
so i can use it like this:
Код:
if(GetPlayerVehicleID(playerid) == bla) //than the vehicleid would not be 1,2 or 3
(I know these codes wonґt work but its just for explaining)
i hope you know what i mean...I searched on wiki but didnґt found anything like this
Re: variable question ?! -
Gamer_Z - 30.06.2009
did you ever see some func like SetPlayerRandomSpanw(); or how they make checkpoints in 1 new...
for example:
Код:
new bla= {
{1},
{2},
{3},
};
Re: variable question ?! -
dice7 - 30.06.2009
You can use it as an array
pawn Код:
new bla[5];
bla[0] = 1;
bla[1] = 456;
bla[4] = 3134;
Re: variable question ?! -
SEC - 30.06.2009
Quote:
|
Originally Posted by dice7
You can use it as an array
pawn Код:
new bla[5]; bla[0] = 1; bla[1] = 456; bla[4] = 3134;
|
but how can i ask for all arrays ?
Re: variable question ?! -
Grim_ - 30.06.2009
Loop through them.
Re: variable question ?! -
SEC - 30.06.2009
Quote:
|
Originally Posted by Swift_
Loop through them.
|
how? can you give me an exemple pls?
Re: variable question ?! -
Grim_ - 30.06.2009
Use a for() or while() loop. Find them on the wiki.
Re: variable question ?! -
dice7 - 30.06.2009
In your case:
pawn Код:
new bla[] = {
444,
546,
490, //vehicle ids
547,
546,
};
for(new a = 0 ; a < 5 ; a++)
{
if(bla[a] == GetPlayerVehicleID(playerid))
{
RemovePlayerFromVehicle(playerid);
}
}
Re: variable question ?! -
SEC - 30.06.2009
thank you