04.11.2012, 12:49
As you see TotalGameTime returns PlayerInfo[ playerid ][ TotalTime ], you should save that one and order players by its value.
As you see I used totaltime, a simple integer.
Then for the Top.
LIMIT 5 is the max rows will be returned, I mean, 5 players.
pawn Код:
public OnPlayerDisconnect(playerid, reason) {
new query[128], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(query,128,"UPDATE Accounts SET totaltime = %d WHERE nickname = '%s'",TotalGameTime(playerid),name);
mysql_query(query);
return 1;
}
Then for the Top.
pawn Код:
mysql_query("SELECT nickname FROM accounts ORDER BY totaltime LIMIT 5");