Raised This Month: $7 Target: $400
 1% 

Loop


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
FeehSK
Junior Member
Join Date: Jul 2019
Location: MT - BRAZIL.
Old 04-02-2021 , 11:09   Loop
Reply With Quote #1

Hello, can someone there explain to me how I can get the 3 best players from Cade Time (CTS and THREE)
FeehSK is offline
Send a message via Skype™ to FeehSK
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 04-02-2021 , 11:42   Re: Loop
Reply With Quote #2

What is Cade Time?
What do you mean by "CTS AND THREE"?
You want "best players" according to what metric?
__________________
HamletEagle is offline
FeehSK
Junior Member
Join Date: Jul 2019
Location: MT - BRAZIL.
Old 04-02-2021 , 12:27   Re: Loop
Reply With Quote #3

Quote:
Originally Posted by HamletEagle View Post
What is Cade Time?
What do you mean by "CTS AND THREE"?
You want "best players" according to what metric?
I mean catching the best terrorist and counter-terrorist players.
Sorry for my English.
FeehSK is offline
Send a message via Skype™ to FeehSK
Natsheh
Veteran Member
Join Date: Sep 2012
Old 04-02-2021 , 15:12   Re: Loop
Reply With Quote #4

best at what exactly, fragging for example?
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
FeehSK
Junior Member
Join Date: Jul 2019
Location: MT - BRAZIL.
Old 04-02-2021 , 21:10   Re: Loop
Reply With Quote #5

Quote:
Originally Posted by Natsheh View Post
best at what exactly, fragging for example?
Frags
FeehSK is offline
Send a message via Skype™ to FeehSK
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-03-2021 , 12:13   Re: Loop
Reply With Quote #6

Not thoroughly tested. For now it just prints to server console, not sure what you planned on doing with the best players. You can easily make it get the best players considering kills minus deaths.
PHP Code:

#include <amxmodx>
#include <cstrike>

new const Version[] = "0.1";

enum _:ScoreData
{
    
SD_PlayerID,
    
SD_Frags
}

public 
plugin_init() 
{
    
register_plugin"Best Team Players" Version "bugsy" );
    
    
register_clcmd"say best" "GetBest" );
}

public 
GetBestid )
{
    new 
iPlayers32 ] , iNum CsTeams:csTeam iTeamIndexCsTeams ] , id szName32 ] , iFrags;
    new 
iBestPlayersCsTeams ][ MAX_PLAYERS ][ ScoreData ];

    
get_playersiPlayers iNum );
    
    for ( 
iNum i++ )
    {
        
id iPlayers];
        
        if ( 
CS_TEAM_T <= ( csTeam cs_get_user_teamid ) ) <= CS_TEAM_CT )
        {
            if ( ( 
iFrags get_user_fragsid ) ) > 
            {
                
iBestPlayerscsTeam ][ iTeamIndexcsTeam ] ][ SD_PlayerID ] = id;
                
iBestPlayerscsTeam ][ iTeamIndexcsTeam ] ][ SD_Frags ] = iFrags;
                
iTeamIndexcsTeam ]++;
            }
        }
    }
    
    
SortCustom2D_:iBestPlayersCS_TEAM_T ] , iTeamIndexCS_TEAM_T ]  , "SortCompare" );
    
SortCustom2D_:iBestPlayersCS_TEAM_CT ] , iTeamIndexCS_TEAM_CT ] , "SortCompare" );
    
    
iTeamIndexCS_TEAM_T ] = miniTeamIndexCS_TEAM_T ] );
    
iTeamIndexCS_TEAM_CT ] = miniTeamIndexCS_TEAM_CT ] );
    
    for ( 
csTeam CS_TEAM_T csTeam <= CS_TEAM_CT csTeam++ )
    {
        if ( 
iTeamIndexcsTeam ] )
        {
            for ( 
iTeamIndexcsTeam ] ; i++ )
            {
                
get_user_nameiBestPlayerscsTeam ][ ][ SD_PlayerID ] , szName charsmaxszName ) );
                
server_print"* %s #%d best is %s with %d frags" csTeam == CS_TEAM_T "T" "CT" i+szName  iBestPlayerscsTeam ][ ][ SD_Frags ] );
            }
        }
        else
        {
            
server_print"* Team %s has no players with frags." csTeam == CS_TEAM_T "T" "CT" );
        }
    }
    
    return 
PLUGIN_HANDLED;
}

public 
SortCompareelem1[] , elem2[] ) 

    if ( 
elem1] > elem2] ) 
        return -
1
    else if(
elem1] < elem2] ) 
        return 
1
    else
        return 
0

__________________
Bugsy is offline
FeehSK
Junior Member
Join Date: Jul 2019
Location: MT - BRAZIL.
Old 04-03-2021 , 13:33   Re: Loop
Reply With Quote #7

Quote:
Originally Posted by Bugsy View Post
Not thoroughly tested. For now it just prints to server console, not sure what you planned on doing with the best players. You can easily make it get the best players considering kills minus deaths.
PHP Code:

#include <amxmodx>
#include <cstrike>

new const Version[] = "0.1";

enum _:ScoreData
{
    
SD_PlayerID,
    
SD_Frags
}

public 
plugin_init() 
{
    
register_plugin"Best Team Players" Version "bugsy" );
    
    
register_clcmd"say best" "GetBest" );
}

public 
GetBestid )
{
    new 
iPlayers32 ] , iNum CsTeams:csTeam iTeamIndexCsTeams ] , id szName32 ] , iFrags;
    new 
iBestPlayersCsTeams ][ MAX_PLAYERS ][ ScoreData ];

    
get_playersiPlayers iNum );
    
    for ( 
iNum i++ )
    {
        
id iPlayers];
        
        if ( 
CS_TEAM_T <= ( csTeam cs_get_user_teamid ) ) <= CS_TEAM_CT )
        {
            if ( ( 
iFrags get_user_fragsid ) ) > 
            {
                
iBestPlayerscsTeam ][ iTeamIndexcsTeam ] ][ SD_PlayerID ] = id;
                
iBestPlayerscsTeam ][ iTeamIndexcsTeam ] ][ SD_Frags ] = iFrags;
                
iTeamIndexcsTeam ]++;
            }
        }
    }
    
    
SortCustom2D_:iBestPlayersCS_TEAM_T ] , iTeamIndexCS_TEAM_T ]  , "SortCompare" );
    
SortCustom2D_:iBestPlayersCS_TEAM_CT ] , iTeamIndexCS_TEAM_CT ] , "SortCompare" );
    
    
iTeamIndexCS_TEAM_T ] = miniTeamIndexCS_TEAM_T ] );
    
iTeamIndexCS_TEAM_CT ] = miniTeamIndexCS_TEAM_CT ] );
    
    for ( 
csTeam CS_TEAM_T csTeam <= CS_TEAM_CT csTeam++ )
    {
        if ( 
iTeamIndexcsTeam ] )
        {
            for ( 
iTeamIndexcsTeam ] ; i++ )
            {
                
get_user_nameiBestPlayerscsTeam ][ ][ SD_PlayerID ] , szName charsmaxszName ) );
                
server_print"* %s #%d best is %s with %d frags" csTeam == CS_TEAM_T "T" "CT" i+szName  iBestPlayerscsTeam ][ ][ SD_Frags ] );
            }
        }
        else
        {
            
server_print"* Team %s has no players with frags." csTeam == CS_TEAM_T "T" "CT" );
        }
    }
    
    return 
PLUGIN_HANDLED;
}

public 
SortCompareelem1[] , elem2[] ) 

    if ( 
elem1] > elem2] ) 
        return -
1
    else if(
elem1] < elem2] ) 
        return 
1
    else
        return 
0

Thank you very much! I tested it here, and it's working perfectly.
FeehSK is offline
Send a message via Skype™ to FeehSK
Reply


Thread Tools
Display Modes

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 07:35.


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