SA-MP Forums Archive
[HELP] Sort scoreboard by score! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP] Sort scoreboard by score! (/showthread.php?tid=370173)



[HELP] Sort scoreboard by score! - anito - 19.08.2012

Hello. How can i sort scoreboard by score. For example, player with highest score is first and etc.

I tried this https://sampforum.blast.hk/showthread.php?pid=1092420#pid1092420 but i dont know how to use it!


Re: [HELP] Sort scoreboard by score! - avivelkayam - 19.08.2012

if i understand you, tou want to check the player who has the biggest score:

i'l build for you stock

Код:
stock GetHighestScore()
{
    new score,player;
    for(new i; i<MAX_PLAYERS; i++) if(IsPlayerConnected(i)) if(GetPlayerScore(i) > score) score  = GetPlayerScore(i),player = i;
    return player;
}
and if you want to check the player with the highest score:

Код:
new highscoreplayer = GetHighestScore();
and in the highscoreplayer it has the id of the player with the highest score..