19.01.2016, 20:16
Quote:
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. |