06.09.2018, 13:00
PHP код:
const max_sort = 3;
new toSort[MAX_PLAYERS][2], bool:found, tmpstring[2048];
for(new i=GetPlayerPoolSize(),idx; i != -1; i--)
{
if(!IsPlayerConnected(i) || IsPlayerNPC(i) || PlayerDamage[i] <= 0) continue;
toSort[idx][0] = PlayerDamage[i];
toSort[idx++][1] = i;
}
SortDeepArray(toSort, 0, .order = SORT_DESC);
SendClientMessageToAll(-1, "{ffdd99}*** Top players by damage");
for(new i; i<max_sort; i++)
{
if(toSort[i][0] == 0) break;
found=true;
format(tmpstring, sizeof(tmpstring), "{ffdd99}*** %i) %s with %d damage", i + 1, PlayerName[i], PlayerDamage[i]);
SendClientMessageToAll(-1, tmpstring);
}
if(!found) return SendClientMessage(playerid, -1, "{ffdd99}Nobody has dealt any damage.");