Raised This Month: $51 Target: $400
 12% 

Team Balance


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Cirovic
Senior Member
Join Date: Sep 2019
Old 12-03-2021 , 10:25   Team Balance
Reply With Quote #1

I Need team balance plugin but not to count players in team, count wins..

CT won 15 rounds and tr won 0.. and thats not fair, can someone make it to send best player in enemy team or smth like that, is there plugin?
Cirovic is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 12-03-2021 , 11:21   Re: Team Balance
Reply With Quote #2

As far as most dominate player redistribution there's Kill / Death Ratio Team Balance. Looks like it needs some work. Comments were made.


I have a plugin, of the sort. Vote for it. Once voted in, teams are swapped every so many rounds. I like the idea of auto-admin to balance the dominate leaders. Will be adding and sharing that later unless you like something else already.
PHP Code:
/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301, USA.
 *
 */

#include amxmodx
#include amxmisc
#include cstrike
#include hamsandwich
#define MAX_PLAYERS                 32
#define MAX_USER_INFO_LENGTH       256
#define TASKID 5007

#define PLUGIN "Auto-Team swap"
#define VERSION "1.0"
#define AUTHOR ".sρiηX҉."
#define VOTE_ACCESS     ADMIN_CFG
new vote_count[2]

new 
counterpfTimepMroundspRestart
new bool:TERR[MAX_PLAYERS+1],bool:AFK[MAX_PLAYERS+1]


public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_logevent("@OnRoundStart"2"1=Round_Start")
    
register_logevent("@OnRoundEnd"2"1=Round_End")
    
register_concmd("swap_vote","cmdVote",VOTE_ACCESS,": Vote for autoswapping teams")


    
pfTime   register_cvar("amx_hud_time""5.0")
    
pMrounds register_cvar("amx_max_rounds""2")
    
pRestart get_cvar_pointer("sv_restartround")

    
register_menucmd(register_menuid("Autoswap teams?"),(1<<0)|(1<<1),"voteTeamSwitch")

}

@
OnRoundStart()
    if(!
get_pcvar_num(pRestart) && get_gametime() > get_pcvar_float(pfTime) * 2.0 )
        
counter++

@
OnRoundEnd()
if(
get_pcvar_num(pfTime))
    @
hud_task()

@
hud_task()
{
    if(!
get_pcvar_num(pRestart) && get_gametime() > get_pcvar_float(pfTime) * 2.0 )
        if(!
task_exists(TASKID ))
            
set_task(get_pcvar_float(pfTime)/4,"@New_Hud",TASKID )
}

@
New_Hud()
{
    new 
switch_sound[MAX_PLAYERS]
    
set_dhudmessage(1002550, -1.00.501get_pcvar_float(pfTime)/4get_pcvar_float(pfTime));
    if(
counter >= get_pcvar_num(pMrounds))
    {
        
show_dhudmessage(0"Switching Teams!");counter 0

        
for (new player=1player<=32player++)
        {
            if(
is_user_connected(player))

            {

                if(
get_user_team(player) == 1)
                    
TERR[player] = true
                
else if(get_user_team(player) == 2)
                    
TERR[player] = false
                
else
                    
AFK[player] = true

                
if(cs_get_user_vip(player))
                    
cs_set_user_vip(player,0,0,0)

                if(!
AFK[player])
                {
                    
cs_set_user_team(player,TERR[player] ? CS_TEAM_CT CS_TEAM_T,CS_DONTCHANGEfalse)

                    if(
cs_get_user_vip(player))
                    {
                        
cs_set_user_vip(player,0,0,0)
                        
ExecuteHamB(Ham_CS_RoundRespawnplayer)
                        
set_pcvar_num(pRestart,1)
                    }

                    new 
iNum random_num(1,5)
                    
formatex(switch_sound,charsmax(switch_sound),"spk sound/hostage/hos%i.wav",iNum)

                    switch(
random_num(0,1))
                    {
                        case 
0client_cmd(player,"%s",switch_sound)
                        case 
1client_cmd(player,"spk ^"team switch^"")
                    }
                }
            }
        }
    }
    else
    {
        new 
switch_time[16]
        new 
bottom_line get_pcvar_num(pMrounds) - counter
        num_to_word
(bottom_lineswitch_timecharsmax(switch_time))
        
client_cmd(0,"spk ^"%s round until switch^"",switch_time)
        
show_dhudmessage(0"Rounds Until Switching: %i"bottom_line);
    }


}

public 
cmdVote(id,level,cid) {
    if(!
cmd_access(id,level,cid,1) || task_exists(3517)) return PLUGIN_HANDLED

    
new keys = (1<<0|1<<1)
    for(new 
02i++)
        
vote_count[i] = 0

    
new menu[MAX_USER_INFO_LENGTH]
    new 
len format(menu,charsmax(menu),"[AMX] %s Autoswap teams?^n"get_pcvar_float(pfTime) ? "Disable" "Enable")
    
len += format(menu[len],charsmax(menu),"^n1. Yes")
    
len += format(menu[len],charsmax(menu),"^n2. No")

    
show_menu(0,keys,menu,10)
    
set_task(10.0,"vote_results",3517)
    return 
PLUGIN_HANDLED
}

public 
voteTeamSwitch(idkey)
    
vote_count[key]++

public 
vote_results()
{
    if(
vote_count[0] > vote_count[1])
    {
        
client_print(0,print_chat,"[%s %s] Voting successfully (yes ^"%d^") (no ^"%d^") %s is now %s"PLUGINVERSIONvote_count[0], vote_count[1], PLUGINget_pcvar_float(pfTime) ? "disabled" "enabled")
        
set_pcvar_float(pfTime,get_pcvar_float(pfTime) ? 0.0 5.0)
    }else{
        
client_print(0,print_chat,"[%s %s] Voting failed (yes ^"%d^") (no ^"%d^")"PLUGINVERSIONvote_count[0], vote_count[1])
    }


I looked at over 100 plugins. 10 pages of Google search results.
__________________
DJEarthQuake is offline
Nutu_
AlliedModders Donor
Join Date: Mar 2016
Location: Germany
Old 12-04-2021 , 12:27   Re: Team Balance
Reply With Quote #3

I've used ptb (https://forums.alliedmods.net/showthread.php?t=26598) and to be honest, i never seen a score like that with it ;)
__________________
a simple act of caring creates an endless ripple.
Nutu_ is offline
Cirovic
Senior Member
Join Date: Sep 2019
Old 12-04-2021 , 20:12   Re: Team Balance
Reply With Quote #4

Quote:
Originally Posted by Nutu_ View Post
I've used ptb (https://forums.alliedmods.net/showthread.php?t=26598) and to be honest, i never seen a score like that with it ;)
should i use mp_autoteambalance on 0 or keep 1?
Cirovic is offline
Nutu_
AlliedModders Donor
Join Date: Mar 2016
Location: Germany
Old 12-05-2021 , 05:47   Re: Team Balance
Reply With Quote #5

PHP Code:
// These two cvars must be set to 0 so PTB can work properly.
mp_autoteambalance 0
mp_limitteams 0 
__________________
a simple act of caring creates an endless ripple.
Nutu_ is offline
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
Reply



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


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