Loops
From SA-MP Wiki
Needs description here.
for(new i=0; i<MAX_PLAYERS; i++) { // Do stuff here }
[edit]
Explained
new i=0;
Creates the variable 'i' and sets it to 0
i<MAX_PLAYERS;
If the loop is less than MAX_PLAYERS (500) it will continue
i++
Adds one to i each time
Loops are usually used to loop through all vehicles or players, and do something to them
OnPlayerSpawn(playerid) { for(new i=0; i<MAX_PLAYERS; i++) { if(!IsPlayerConnected(i)) continue; SendClientMessage(i, 0x33AA33AA, "Someone spawned!"); } return 1; }
That could be an alternative to SendClientMessageToAll.
Also, the variable does not have to be called 'i', it can be assigned any name.
for(new blah=0; blah<MAX_VEHICLES; blah++)
| This article/section is a stub You can help SA-MP by expanding it |
|

