Top score player
#1

Hi. I need system, that choose one player, who have highest online score ( pInfo[playerid][score] ) and give them money. How to choose that one player from mysql? I know, that it is possible to do with ORDER BY and DESC LIMIT, but how I dont know :/ Maybe somebody can help me?
Reply
#2

Wait, you need to check the most higher score ONLINE or offline?

Because if is online, you don't need a mysql query, but just this:

pawn Код:
CMD:scorelist(playerid)
{
    new data[MAX_PLAYERS][2];
    foreach (new i : Player)
    {
        data[i][0] = GetPlayerScore(i);
        data[i][1] = i;
    }

    QuickSort_Pair(data, true, 0, Iter_Count(Player));

    SendClientMessage(playerid, -1, "* Top 5 players with high score currently online:");
    new buf[150];
    for (new i; i < 5; i++)
    {
        if (data[i][0])
        {
            format(buf, sizeof(buf), "%i. %s (%i) - %i$", i + 1, ReturnPlayerName(data[i][1]), data[i][1], data[i][0]);
            SendClientMessage(playerid, -1, buf);
        }
    }
    return 1;
}
Reply
#3

I need to check online and offline.
Reply
#4

Quote:
Originally Posted by ,TomY'
Посмотреть сообщение
I need to check online and offline.
For online i give you already the code. If you can wait, when i'll come back i can try to make something for offline check. Or just wait others.
Reply
#5

Ok, I will wait.
Reply
#6

Any help? :/
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)