Raised This Month: $ Target: $400
 0% 

Team Balance


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 


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 11:28.


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