Posts: 731
Threads: 29
Joined: Feb 2012
Reputation:
0
I think you can only do that with MySQL. With .ini files you can loop through the online players. I am not sure tho.
Posts: 895
Threads: 106
Joined: Feb 2012
Reputation:
0
Hmmh, I have never get used to INI, but i don't think it's possible, since you will have to open and read all player files which will lag no matter what. If it was mysql (BlueG). It's easiere than school exam :3
Posts: 11,827
Threads: 33
Joined: Dec 2011
Reputation:
0
I know it's only possible with SQL. The way I could think of making it was to store the top 5 in each category in a file and read it from there.
Posts: 319
Threads: 7
Joined: Jul 2012
Reputation:
0
It will also be funny when you have the 3 topscores mentioned above (killers, score and quiters) and you've saved them all into 3 separate files.
And later on, you decide to add another topscore to find out who has the most money, and by that time you have 10000+ registered players.
You would need to create a test-script to read all those 10000 playerfiles, sort the players from rich to poor through code yourself to get the 5 richest players on your server and write those 5 to a new topscore file.
This test-script would be required to prevent lagging your server while it's reading and analyzing 10000+ playerfiles.
Using MySQL, it would simply be a matter of creating the proper query and let MySQL figure it out in the background without putting any stress on your server.
Using threaded queries, you won't notice any lag, even when you would have 1 million registered accounts.
You may notice a small delay between entering the command and seeing the results because MySQL processes your query in another thread which may take some time, but you won't ever see any lag while MySQL is working.
It can find and sort the data you want in one simple query, where you need to create alot more code to read all playerfiles and sort them manually through code yourself if you were to use ini files.
To answer a question in the previous post:
"Only once" is meant to let that command read all playerfiles once, sort them by the required value and write the topscore file for that value.
Once this file exists, you can simply update the file (overwrite it) everytime the topscores change, without the need to re-read all playerfiles again.