[Question]Variables
#1

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)