06.10.2011, 19:55
Quote:
Hey,
I'm new at pawno scripting and still learning it . I've seen this many times and i still don't know what it means : Код:
for(new i = 0; i < MAX_PLAYERS; i++) Thanks in advance . |
Let's say you have 4 players connected:
Player ID 0: Jack
Player ID 1: Dean
Player ID 2: Paul
Player ID 3: Sam
The rest of slots are empty slot. So, to don't check each player in 500 lines, like:
PHP код:
if(IsPlayerConnected(0)) /* Do code */
if(IsPlayerConnected(1)) /* Do code */
if(IsPlayerConnected(2)) /* Do code */
if(IsPlayerConnected(3)) /* Do code */
if(IsPlayerConnected(4)) /* Do code */
/*..................................*/
if(IsPlayerConnected(99)) /* Do code */
if(IsPlayerConnected(100)) /* Do code */
/*..................................*/
if(IsPlayerConnected(300)) /* Do code */
if(IsPlayerConnected(301)) /* Do code */
/*..................................*/
if(IsPlayerConnected(499)) /* Do code */
if(IsPlayerConnected(500)) /* Do code */
PHP код:
for(new i = 0; i < MAX_PLAYERS; i++)
if(IsPlayerConnected(i))
/* Do code */