SA-MP Forums Archive
Arrays help - 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)
+--- Thread: Arrays help (/showthread.php?tid=289640)



Arrays help - Cowboy - 12.10.2011

Hello,

I have this right now under OnPlayerDisconnect:

pawn Код:
Test[playerid][0] = 0;
    Test[playerid][1] = 0;
    Test[playerid][2] = 0;
    Test[playerid][3] = 0;
    Test[playerid][4] = 0;
and it works but I have a question if it's possible if you can set all those to 0 in 1 line

Example(I have tried this it won't work but just to show what I mean)

pawn Код:
Test[playerid[0, 1, 2, 3, 4] = 0
I would need something like this in the future

thanks


Re: Arrays help - CyNiC - 12.10.2011

Impossible, but you can make it in one line using a loop:
pawn Код:
for(new i = 0; i < sizeof Test[]; i++) Test[playerid][i] = 0;



Re: Arrays help - aRoach - 12.10.2011

Or you can do this:
pawn Код:
Test[ playerid ][ 0 || 1 || 2 || 3 || 4 ] = 0;