variable question ?!
#1

Hey guyz,
is it possible to define a variable for more than one thing?
like this :
Код:
new bla = 1,2,3
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
Reply
#2

did you ever see some func like SetPlayerRandomSpanw(); or how they make checkpoints in 1 new...
for example:
Код:
new bla= {
{1},
{2},
{3},
};
Reply
#3

You can use it as an array
pawn Код:
new bla[5];
bla[0] = 1;
bla[1] = 456;
bla[4] = 3134;
Reply
#4

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 ?
Reply
#5

Loop through them.
Reply
#6

Quote:
Originally Posted by Swift_
Loop through them.
how? can you give me an exemple pls?
Reply
#7

Use a for() or while() loop. Find them on the wiki.
Reply
#8

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);
    }
}
Reply
#9

thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)