Raised This Month: $ Target: $400
 0% 

Best 2 CT players


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
kotinha
Senior Member
Join Date: Jun 2009
Location: Alentejo, Portugal :)
Old 10-29-2011 , 14:54   Re: Best 2 CT players
Reply With Quote #7

Not tested:
PHP Code:
public getBestCT(bestcts[2]) {
    
    new 
players[32], num
    get_players
(players,num)
    
    new 
cts[32], n
    
for(new inumi++) {
        if(
cs_get_user_team(players[i]) == CS_TEAM_CT) {
            
cts[n] = players[i]
            
n++;
        }
    }
    
    
SortCustom1D(ctssizeof cts"fnSortScores")
    
    
// cts[0] = first place
    // cts[1] = second place
    // cts[2] = third place
    // ...
}
public 
fnSortScores(elem1elem2) {
    new 
frags1 get_user_frags(elem1), frags2 get_user_frags(elem2)
    new 
deaths1 get_user_deaths(elem1), deaths2 get_user_deaths(elem2)
    
    if(
frags1 frags2)
        return -
1;
    else if (
frags1 frags2)
        return 
1;
    else {
        if(
deaths1 deaths2)
            return 
1;
        else if(
deaths1 deaths2)
            return -
1;
        else
            return 
0;
    }
    
    return 
0;

It's like nikhilgupta345 said, with SortCustom1D() to avoid wrong results, however I don't know if the scoreboard works like nikhilgupta345 said.
I think that it has the same bug that Backstabnoob made in his script
__________________
"If God exists, I hope he has a good excuse." - Woody Allen
kotinha 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 14:19.


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