Posts: 118
Threads: 59
Joined: Dec 2011
Reputation:
0
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?
Posts: 716
Threads: 92
Joined: May 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;
}
Posts: 118
Threads: 59
Joined: Dec 2011
Reputation:
0
I need to check online and offline.
Posts: 716
Threads: 92
Joined: May 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.