Arrays help
#1

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
Reply
#2

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;
Reply
#3

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


Forum Jump:


Users browsing this thread: 1 Guest(s)