MySQL based top 5 textdraw list.
#1

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?
Reply
#2

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
Reply
#3

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)