10.10.2011, 16:56
Examples:
Set a value for all players.
[pawn]
for ( // create the loop
new i = 0; //create a new zero variable
i < MAX_PLAYERS; // same with if (i < MAX_PLAYERS)
i++ ) // code to execute after every run (Increments i)
2nd example:
(same)
3rd example:
(same)
Set a value for all players.
pawn Код:
for (new i=0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
Value[i] = 1;
}
}
for ( // create the loop
new i = 0; //create a new zero variable
i < MAX_PLAYERS; // same with if (i < MAX_PLAYERS)
i++ ) // code to execute after every run (Increments i)
2nd example:
(same)
pawn Код:
new i = 0;
while (i < MAX_PLAYERS)
{
if (IsPlayerConnected(i))
{
Value[i] = 1;
}
i++;
}
(same)
pawn Код:
new i = 0;
until (i == MAX_PLAYERS)
{
if (IsPlayerConnected(i))
{
Value[i] = 1;
}
i++;
}