19.09.2016, 20:07
Okay, i show you how it would be pretty 
First download this include: https://sampforum.blast.hk/showthread.php?tid=343172
Not tested, but should work

First download this include: https://sampforum.blast.hk/showthread.php?tid=343172
PHP код:
CMD:top10(playerid, params[])
{
if(gLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_ERROR, "Tu nu esti logat si nu poti sa folosesti aceasta comanda!");
const max_sort = 10;
new toSort[MAX_PLAYERS][2], string[16 + (MAX_PLAYER_NAME+3)*max_sort] = "Nume\tOre jucate\n", bool:found;
for(new i=GetPlayerPoolSize(),idx; i != -1; i--)
{
if(!IsPlayerConnected(i) || IsPlayerNPC(i) || PlayerInfo[i][pHoursPlayed] <= 0) continue;
toSort[idx][0] = PlayerInfo[i][pHoursPlayed];
toSort[idx++][1] = i;
}
SortDeepArray(toSort, 0, .order = SORT_DESC);
for(new i,n[MAX_PLAYER_NAME]; i<max_sort; i++)
{
if(toSort[i][0] == 0) break;
found=true;
GetPlayerName(toSort[i][1],n,MAX_PLAYER_NAME);
format(string,sizeof(string),"%s%s\t%d\n",string,n,toSort[i][0]);
}
if(!found) return SendClientMessage(playerid, COLOR_ERROR, "No players where found yet!");
ShowPlayerDialog(playerid, 1337, DIALOG_STYLE_TABLIST_HEADERS, "Top 10 jucatori activi", string, "Iesi", "");
return 1;
}
