Give money to all?
#5

new i = 0; << creates a new variable named "i" and initializes it to 0

i < MAX_PLAYERS; << keep running through the loop while the value of i is less than the maximum number of players

i++ << increment the variable i by 1 each time the loop recycles. This is done until i equals the maximum number of players

Anything inside the first { and last } is executed each time the loop makes a pass. We added IsPlayerConnected to ensure that the server doesn't attempt to run code on a playerid that doesn't exist. At the least this will cause the loop to take longer than it should, and at the worst it will crash the server as it tries to run code on someone who isnt there.

Reply


Messages In This Thread
Give money to all? - by krawN - 13.07.2009, 19:32
Re: Give money to all? - by kaisersouse - 13.07.2009, 19:35
Re: Give money to all? - by krawN - 13.07.2009, 19:39
Re: Give money to all? - by arnutisz - 13.07.2009, 19:46
Re: Give money to all? - by kaisersouse - 13.07.2009, 19:55

Forum Jump:


Users browsing this thread: 1 Guest(s)