SA-MP Forums Archive
Top score player - 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: Top score player (/showthread.php?tid=658009)



Top score player - ,TomY' - 20.08.2018

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?


Re: Top score player - KinderClans - 20.08.2018

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;
}



Re: Top score player - ,TomY' - 20.08.2018

I need to check online and offline.


Re: Top score player - KinderClans - 20.08.2018

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.


Re: Top score player - ,TomY' - 20.08.2018

Ok, I will wait.


Re: Top score player - ,TomY' - 20.08.2018

Any help? :/