07.03.2016, 10:13
How can I make a command search through all the user scriptfiles made by y_ini, for a specific value? Let's say for an example I want to make a list of top 10 richest players or I don't know.
I'd make this completely without files (at least during runtime).
Make an array for the richest players (size of 10 for example) and store playernames and the according money inside it. Then you can occasionally check if any player has more money as anyone else in that list and put him in accordingly. Then load/save it from/to a file in OnGameModeInit/Exit. Doing this with files during runtime has many drawbacks. You have to either use a file system (like y_ini) which is generally slower for this application or re-write the whole file if the order changes (which can be very often if you have many rich players online). The array lets u just switch two entries (or more if you need to reorder) and it's a LOT faster. |