SA-MP Forums Archive
[Question]Variables - 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: [Question]Variables (/showthread.php?tid=299462)



[Question]Variables - b.rock - 26.11.2011

Can someone tell me what's the difference between:

Код:
pinfo[MAX_PLAYERS][3];

OnPlayerConnect(playerid)
{
pinfo[playerid][0] = 0;
pinfo[playerid][1] = 0;
pinfo[playerid][2] = 0;
return 1;
}
and

Код:
pinfo[MAX_PLAYERS][3];

OnPlayerConnect(playerid)
{
for(new x = 0; x < 3; x++)
{
pinfo[playerid][x] = 0;
}
return 1;
}
which one is better?


Re: [Question]Variables - Rob_Maate - 26.11.2011

They are two ways of achieving the exact same thing.
Neither is better, however you will find that if you have 90 arrays;
as in

pinfo[playerid][0]
pinfo[playerid][1]
pinfo[playerid][2]
pinfo[playerid][3]
pinfo[playerid][4]
pinfo[playerid][6]

etc...

It's a lot quicker to reset them with a loop rather than to type out each individual array


Re: [Question]Variables - MP2 - 26.11.2011

I COMPLETELY MIS-READ THE TOPIC IGNORE ME >.<