for loop mucking up again
#2

Quote:
Originally Posted by kazai
but i assume that means it would leave out the last player.
You're wrong.

When you create an array of MAX_PLAYERS cells, say 200, then the valid cells are from 0 to 199. And the max playerid that a player can be is 199.
When you use i <= MAX_PLAYERS, the last iteration will 'call' cell 200 (IsPlayerWorking[200]), which is an invalid cell, and will most likely crash your script.

That is the correct loop:
pawn Код:
for( new i = 0; i < MAX_PLAYERS; i ++ )
Reply


Messages In This Thread
for loop mucking up again - by kazai - 30.07.2009, 05:19
Re: for loop mucking up again - by paytas - 30.07.2009, 05:22
Re: for loop mucking up again - by Joe Staff - 30.07.2009, 05:39
Re: for loop mucking up again - by -Sneaky- - 30.07.2009, 06:22

Forum Jump:


Users browsing this thread: 1 Guest(s)