//*******************************// // UB-MONITOR Team Balancer // // v1.0.3 // // // // NOTE: This Script Forces // // mp_autoteambalance 0 // //*******************************// block config { // Set This To How Many Rounds Are Calculated In To The KDR Averaging. // This Is Also How Often The Check Is Performed. [Default = 5] es_xset ATB_rounds 5 // Set This To The Minimum Ammount Of Average Team KDR Difference Before A Random Team Switch Is Performed. // Please Note Than When The Check Is Performed, It Only Takes Into Account The Last ____ Rounds That happened. // (Depending On What ATB_rounds Is Set To.) [Default = 0.35] es_xset ATB_diff 0.35 // Set The Minimum Amount Of People You Want On Each Team Before A Switch Will Happen. // (To Prevent An Entire Team vs. Nobody) [Default = 2] es_xset ATB_minteamsize 2 // Set This To 1 To Announce When The Next Test Is. // (At The Beginning Of The Round.) [Default = 0] es_xset ATB_announce 0 //****************************************// // DO NOT EDIT ANYTHING AFTER THIS LINE!! // //****************************************// } event es_map_start { es_xdoblock ATB/setup } event player_death { es_getplayerteam temp_ATB_team event_var(userid) if (server_var(temp_ATB_team) == 2) do { es_xmath temp_ATB_t_deaths + 1 es_xmath temp_ATB_ct_kills + 1 } if (server_var(temp_ATB_team) == 3) do { es_xmath temp_ATB_ct_deaths + 1 es_xmath temp_ATB_t_kills + 1 } } event round_start { es_xmath temp_ATB_rounds + 1 if (server_var(ATB_announce) == 1) do { es_xmathparse temp_ATB_rndannce "ATB_rounds - temp_ATB_rounds" if (server_var(temp_ATB_rndannce) >= 2) then es_msg #multi #green [UB-MONITOR] #default server_var(temp_ATB_rndannce) #lightgreen Rounds Left Till Team Check. if (server_var(temp_ATB_rndannce) == 1) then es_xmsg #multi #green [UB-MONITOR] #lightgreen Team Check At The End Of The #default Next Round! if (server_var(temp_ATB_rndannce) == 0) then es_xmsg #multi #green [UB-MONITOR] #lightgreen Round Equality Check At The End Of #default This Round! } } event round_end { if (server_var(temp_ATB_t_deaths) == 0) then es_xset temp_ATB_t_deaths 1 if (server_var(temp_ATB_ct_deaths) == 0) then es_xset temp_ATB_ct_deaths 1 es_xmathparse temp_ATB_total_t_kdr "temp_ATB_t_kills / temp_ATB_t_deaths" es_xmathparse temp_ATB_total_ct_kdr "temp_ATB_ct_kills / temp_ATB_ct_deaths" es_xdelayed 0.1 es_xmathparse temp_ATB_t_kdr_add "temp_ATB_total_t_kdr_last + temp_ATB_total_t_kdr" es_xdelayed 0.3 es_xmathparse temp_ATB_ct_kdr_add "temp_ATB_total_ct_kdr_last + temp_ATB_total_ct_kdr" es_xdelayed 0.5 es_xdoblock ATB/teamcheck es_xdelayed 0.7 es_xdoblock ATB/reset_kd es_xdelayed 0.9 es_set temp_ATB_total_t_kdr_last server_var(temp_ATB_t_kdr_add) es_xdelayed 1.1 es_set temp_ATB_total_ct_kdr_last server_var(temp_ATB_ct_kdr_add) } block teamcheck { if (server_var(temp_ATB_rounds) >= server_var(ATB_rounds)) do { es_xmathparse temp_ATB_t_kdr_add "temp_ATB_t_kdr_add / ATB_rounds" es_xmathparse temp_ATB_ct_kdr_add "temp_ATB_ct_kdr_add / ATB_rounds" if (server_var(temp_ATB_ct_kdr_add) <= server_var(temp_ATB_t_kdr_add)) do { es_xmathparse temp_ATB_subtract "temp_ATB_t_kdr_add - temp_ATB_ct_kdr_add" if (server_var(temp_ATB_subtract) >= server_var(ATB_diff)) do { es_xgetplayercount temp_ATB_teams 2 if (server_var(temp_ATB_teams) > server_var(ATB_minteamsize)) do { getrandplayer temp_ATB_swapplayer #T es_changeteam server_var(temp_ATB_swapplayer) 3 es_xmsg #multi #green [ATB] #lightgreen A Random T has been moved to the CTs to try and even the team's scores. es_tell server_var(temp_ATB_swapplayer) #multi #green [UB-MONITOR] #lightgreen You Have Been Randomly Team Switched To Try and Even The Team Scores! es_playsound server_var(temp_ATB_swapplayer) ambient/alarms/siren.wav 1.0 } if (server_var(temp_ATB_teams) <= server_var(ATB_minteamsize)) then es_xmsg #multi #green [UB-MONITOR] #lightgreen Teams Are Too Small To Change. Ignoring. } else do { es_xmsg #multi #green [UB-MONITOR] #lightgreen Teams Look Fine. No Change Needed. } } if (server_var(temp_ATB_ct_kdr_add) >= server_var(temp_ATB_t_kdr_add)) do { es_xmathparse temp_ATB_subtract "temp_ATB_ct_kdr_add - temp_ATB_t_kdr_add" if (server_var(temp_ATB_subtract) >= server_var(ATB_diff)) do { es_xgetplayercount temp_ATB_teams 3 if (server_var(temp_ATB_teams) > server_var(ATB_minteamsize)) do { getrandplayer temp_ATB_swapplayer #CT es_changeteam server_var(temp_ATB_swapplayer) 2 es_xmsg #multi #green [UB-MONITOR] #lightgreen A Random CT has been moved to the Ts to try and even the team's scores. es_tell server_var(temp_ATB_swapplayer) #multi #green [UB-MONITOR] #lightgreen You Have Been Randomly Team Switched To Try and Even The Team Scores! es_playsound server_var(temp_ATB_swapplayer) ambient/alarms/siren.wav 1.0 } if (server_var(temp_ATB_teams) <= server_var(ATB_minteamsize)) then es_xmsg #multi #green [ATB] #lightgreen Teams Are Too Small To Change. Ignoring. } else do { es_xmsg #multi #green [UB-MONITOR] #lightgreen Teams Look Fine. No Change Needed. } } es_xdoblock ATB/reset_kdr } } block msg { es_xrand temp_ATB_rand 180 300 es_delayed server_var(temp_ATB_rand) es_xmsg #multi #green [UB-MONITOR] #lightgreen This Server Is Running UB-MONITOR Team Balancer Version #default 7.0.0 es_delayed server_var(temp_ATB_rand) es_xdoblock ATB/msg } block reset_kdr { es_xset temp_ATB_ct_deaths 0 es_xset temp_ATB_t_deaths 0 es_xset temp_ATB_t_kills 0 es_xset temp_ATB_ct_kills 0 es_xset temp_ATB_rounds 0 es_xset temp_ATB_total_t_kdr_last 0 es_xset temp_ATB_total_ct_kdr_last 0 es_xset temp_ATB_t_kdr_add 0 es_xset temp_ATB_ct_kdr_add 0 es_xset temp_ATB_total_t_kdr 0 es_xset temp_ATB_total_ct_kdr 0 } block reset_kd { es_xset temp_ATB_ct_deaths 0 es_xset temp_ATB_t_deaths 0 es_xset temp_ATB_t_kills 0 es_xset temp_ATB_ct_kills 0 } block setup { es_xset mp_autoteambalance 0 es_xset temp_ATB_total_ts 0 es_xset temp_ATB_t_kills 0 es_xset temp_ATB_t_deaths 0 es_xset temp_ATB_total_t_kdr 0 es_xset temp_ATB_t_kdr_add 0 es_xset temp_ATB_total_cts 0 es_xset temp_ATB_ct_kills 0 es_xset temp_ATB_ct_deaths 0 es_xset temp_ATB_total_ct_kdr 0 es_xset temp_ATB_ct_kdr_add 0 es_xset temp_ATB_team 0 es_xset temp_ATB_rounds 0 es_xset temp_ATB_rndannce 0 es_xset temp_ATB_subtract 0 es_xset temp_ATB_swapplayer 0 es_xset temp_ATB_teams 0 es_xset temp_ATB_rand 0 es_xset temp_ATB_total_t_kdr_last 0 es_xset temp_ATB_total_ct_kdr_last 0 es_xdoblock ATB/reset_kdr es_xdoblock ATB/msg } block load { es_xset UB-MONITOR_balancer 7.0.0 es_xmakepublic UB-MONITOR_balancer es_xdoblock ATB/config es_xdoblock ATB/setup }