Raised This Month: $ Target: $400
 0% 

Team Balance


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 12-05-2021 , 06:16   Re: Team Balance
Reply With Quote #6

I was working on this untill i got interupted yesterday. As there's been suggested a few alternatives, i won't be finishing it, but i'll share what i've got so far, in case someone else would like to finish it or use it for their own purposes.

PHP Code:
/* Sublime AMXX Editor v2.2 */

#include <amxmodx>
// #include <amxmisc>
#include <cstrike>
// #include <engine>
// #include <fakemeta>
// #include <hamsandwich>
#include <fun>
// #include <xs>
// #include <sqlx>

#pragma semicolon 1

new const g_szVersion[] = "1.0.0";

enum _g_eInfo
{
    
g_iTerWin,
    
g_iCtWin
};

new 
g_iInfo[g_eInfo];

static const 
g_szMessages[] = 
{
    
"#Terrorists_Win",
    
"#CTs_Win",
    
"#Round_Draw",
    
"#Game_Commencing",
    
"#Game_will_restart_in"
};

new 
g_iMsg;

new 
g_pWinStreak;
new 
g_pPlayerTransferAmount;

public 
plugin_init()
{
    
register_plugin("Team Balancer"g_szVersion"NapoleoN#");

    
g_iMsg get_user_msgid("TextMsg");
    
register_message(g_iMsg"checkWinner");

    
g_pWinStreak                 register_cvar("tb_winstreak""5");
    
g_pPlayerTransferAmount     register_cvar("tb_transferamount""2");
}

public 
checkWinner(const iMsg, const iDest, const iMsgEntity

    static 
szMsg[32];
    
get_msg_arg_string(2szMsgcharsmax(szMsg));

    new 
iMaxWinStreak get_pcvar_num(g_pWinStreak);

    if(
equal(szMsgg_szMessages[0]))
    {
        if(++
g_iInfo[g_iTerWin] == iMaxWinStreak)
        {
            
balanceTeams();
        }
    }

    else if(
equal(szMsgg_szMessages[1]))
    {
        if(++
g_iInfo[g_iCtWin] == iMaxWinStreak)
        {
            
balanceTeams();
        }
    }

    else 
    {
        
g_iInfo[g_iTerWin] = 0;
        
g_iInfo[g_iCtWin] = 0;
    }
}

public 
balanceTeams()
{
    new 
iPlayers[32], iCountiKills[33];
    
get_players(iPlayersiCount"che""TERRORIST");

    for(new 
iiCounti++)
    {
        
iKills[iPlayers[i]] = get_user_frags(iPlayers[i]);
    }

    
SortIntegers(iKillssizeof(iKills), Sort_Descending);

Keep in mind that this plugin will not be working, the only thing it's doing now, is keeping track of the winstreaks.
__________________

Last edited by Napoleon_be; 12-05-2021 at 06:16.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
 


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 09:00.


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