PHP код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/top10", true) == 0)
{
new top, str[64], str2[256], maxx;
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(GetPlayerScore(i) > top) { top = GetPlayerScore(i); }
}
for(new t = top; t >= 0; t--)
{
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(!IsPlayerConnected(i)) continue;
if(GetPlayerScore(i) != t) continue;
GetPlayerName(i, str, 24);
maxx++;
format(str, sizeof str, " %d >> %s - Score: %d", maxx, str, GetPlayerScore(i));
strcat(str2, str);
}
ShowPlayerDialog(playerid, 150, "TOP 10", str2, "Close", "");
if(maxx == 10) break;
}
return 1;
}
return 0;
}