|
|
02-11-2007
, 16:18
Re: Rates Check
|
#15
|
Ok ill explain this in full and then you can see if i'm wrong (which is possible, I just haven't had any problems yet)
Say the server has 3 players :
Player1 #1 with rates 60, 60, 20000
Player2 #4 with rates 10, 20, 9999
Player3 #8 with rates 101,101, 25000
When an admin types get_rates, it calls get_players which returns
num = 3
and players[0] = 1, players[1]=4, players[2]=8
The first loop then cycles through players[i] from 0 to < num (0-2) and loads the rates info into the variables, so..
name[0] = "Player1", rate[0]="20000", updaterate[0]="60" etc
name[1] = "Player2", rate[1]="9999", updaterate[1]="10" etc
name[2] = "Player3", rate[2]="25000", updaterate[2]="101" etc
If player2 d/c at this point, num and the name[1], rate[1] etc variable are left unchanged.
The print_rates() function is then called and this loops through 0 to < num again. So the amount of players that were retrieved when get players was called.
And prints the rates info direct from the saved variables. Even if player 2 is no longer present at this point it will still print their rate info in the correct place.
|
|
|
|