SA-MP Forums Archive
MySQL based top 5 textdraw list. - 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: MySQL based top 5 textdraw list. (/showthread.php?tid=469888)



MySQL based top 5 textdraw list. - Champ - 15.10.2013

I created a list in which it only shows the names of online players. I want to create a list in which the all top 5 killers names from database should be listed in the textdraw.

Do any body know how it will be done?


Re: MySQL based top 5 textdraw list. - [LCK]Chris - 15.10.2013

Possible SQL:
Quote:

SELECT * FROM _Table ORDER BY _Column ASC LIMIT 5;
or
SELECT * FROM _Table ORDER BY _Column DESC LIMIT 5;

Then i guess you would set the text draw text from the data you grabbed with your SQL query


Re: MySQL based top 5 textdraw list. - Champ - 15.10.2013

i don't now how to fit this into the textdraw.
here is the code

pawn Код:
public UpDateTextDraw(playerid)
{
    new
        playerScores[MAX_PLAYERS][rankingEnum],
        index
    ;
    for(new i; i != MAX_PLAYERS; ++i)
    {
        if(IsPlayerConnected(i) && !IsPlayerNPC(i))
        {
            playerScores[index][player_Score] = GetPlayerScore(i);
            playerScores[index++][player_ID] = i;
        }
    }
    GetPlayerHighestScores(playerScores, 0, index);

    new
    score_Text[256] = "~n~",
    player_Name[20]
    ;
    for(new i; i < 5; ++i)
    {
    if(i < index)
    {
    GetPlayerName(playerScores[i][player_ID], player_Name, sizeof(player_Name));
    format(score_Text, sizeof(score_Text), "%s~n~~b~%d. ~w~%s ~r~%d", score_Text, i + 1, player_Name, playerScores[i][player_Score]);
    }
    else
    format(score_Text, sizeof(score_Text), "%s~n~~b~%d.", score_Text, i + 1);
    }
    TextDrawSetString(text_Top5[1], score_Text);
    TextDrawShowForAll(text_Top5[1]);
    TextDrawShowForAll(text_Top5[0]);
    return 1;
    }
do any body know how to fix this in the above code?
thank you.