SA-MP Forums Archive
Scoreboard, sorted from highest, to lowest 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Scoreboard, sorted from highest, to lowest score. (/showthread.php?tid=247714)



Scoreboard, sorted from highest, to lowest score. - Biesmen - 10.04.2011

I'm trying to make a scoreboard like this for awhile, but I can't find a method to make this.
I'm creating a scoreboard, with textdraws. But first of all I'm trying to get a top 10 ranking.

I tried different methods. Example method, which fails, but I'm just trying to tell you what I mean:
pawn Код:
new TopScore[10];
stock SortPlayers()
{
    new string[128];
    foreach(Player, i)
    {
        if(GetPlayerScore(i) > 1)
        {
            format(string, sizeof(string), "1. %s    | Score: %i | Deaths: %i", PlayerName(i), GetPlayerScore(i), GetPlayerDeaths(i));
            TopScore[1] = GetPlayerScore(i);
            TextDrawSetString(Textdraw1, string);
        }
        if(GetPlayerScore(i) < TopScore[1])
        {
            format(string, sizeof(string), "2. %s    | Score: %i | Deaths: %i", PlayerName(i), GetPlayerScore(i), GetPlayerDeaths(i));
            TopScore[2] = GetPlayerScore(i);
            TextDrawSetString(Textdraw2, string);
        }
        if(GetPlayerScore(i) < TopScore[2])
        {
            format(string, sizeof(string), "3. %s    | Score: %i | Deaths: %i", PlayerName(i), GetPlayerScore(i), GetPlayerDeaths(i));
            TopScore[3] = GetPlayerScore(i);
            TextDrawSetString(Textdraw3, string);
         }
    }
return 1;
}
I hope you can help me.


Re: Scoreboard, sorted from highest, to lowest score. - Virtual1ty - 10.04.2011

Ryderґ made something like that a while back, lemme search for it.
Edit: THIS might help you..


Re: Scoreboard, sorted from highest, to lowest score. - Biesmen - 10.04.2011

Thank you, I will try something with that.

Edit: I got it working, thanks!