Raised This Month: $ Target: $400
 0% 

[REQ] top frags every round


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 09-26-2011 , 18:47   Re: [REQ] top frags every round
Reply With Quote #3

something like this might work
PHP Code:
public round_end() {
    new 
PlayerFrags[32][2]
    new 
Players[32], num
    get_players
(Playersnum)
    for(new 
0numi++) {
        
PlayerFrags[i][0] = Players[i//player id
        
PlayerFrags[i][1] = get_user_frags(Players[i]) //player frags
    
}
    
SortCustom2D(PlayerFragsi"SortPlayerFrags")
    new 
output[128], name[20], pos
    pos 
+= formatex(outputcharsmax(output), "Top players: ")
    for (new 
03o++) {
        
get_user_name(PlayerFrags[o][0], namecharsmax(name))
        
pos += formatex(output[pos], charsmax(output) - pos"%s "name)
    }
    
client_print(0print_chatoutput)
}  

public 
SortPlayerFrags(elem1[], elem2[]) {
    if (
elem1[0] && elem2[0]) {
        if (
elem1[1] < elem2[1]) return -1
        
else if (elem1[1] == elem2[1]) return 0
        
else return 1
    
}


Last edited by jimaway; 09-26-2011 at 19:34.
jimaway is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:41.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode