How to get the highest score of all players?
#1

Hello, Just want to ask a question, how do I get my player rankings in my server? I mean, how can I know if players has the highest score/level & over all highest bank account of a player automatically.. Is there any script for that? If who ever can help, thanks in advance..
Reply
#2

This depends on your account system.
Do you use any INI system or do you use mysql?

In case of mysql, it can be done very easily by creating the proper query.
Like: "SELECT * FROM playerdata ORDER BY Score DESC LIMIT 10"
This query would select all fields from the table "playerdata", sorts them descending based on scorepoints and limits the result to only 10 players.
These will then be the top 10 players with highest score on your entire server.
To sort them by rank, just replace the "Score" by "Rank" (or whatever your column would be called) and you're done.


For INI systems, you may have to create a separate file that holds the top 10 players for example, as browsing ALL existing playerfiles makes your server lag very badly if you have +1000 registered players.
Using plain samp code, it's not even possible to browse all files in a directory, you need a plugin that can handle that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)