Raised This Month: $ Target: $400
 0% 

Rates Check


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
pRED*
Join Date: Dec 2006
Old 02-11-2007 , 16:18   Re: Rates Check
Reply With Quote #14

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.
pRED* is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:56.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode