SA-MP Forums Archive
help with md-sort.inc - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: help with md-sort.inc (/showthread.php?tid=658539)



help with md-sort.inc - severance - 06.09.2018

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




Re: help with md-sort.inc - severance - 06.09.2018

Anyone? why it doesnt sort from descending , 200 damage should be first and not second.