Simple Team Balancer
Balances the teams based upon player count.
- Admins with RESERVATION flag are immune by default
- Admin flag can be set in simpleteambalancer.cfg
- A player will not be switched more than once in 5 (default) minutes
- Balance buddy systems tries to keep players together
- Ability to restrict the buddy system to stb_adminflag
- Ability to lock buddy selection
- Ability to prioritize players; always prefers dead players
- Ability to control built-in cvars
- Ability to force the player to accept the balanced team
- Ability to log balancer activity
- Bypassed when in TF2 Arena Mode
- buddy <userid> - Adds a balance buddy
- lockbuddy - Locks your balance buddy selection so only you can change it
- stb_enabled - Enable or Disable Simple Team Balancer
- stb_balancedelay - Delay in seconds to start an autobalance
- stb_logactivity - Enable or Disable the displaying of events in the log
- stb_logactivity2 - Enable or Disable the displaying of detailed events in the log (This will spam log)
- stb_unbalancelimit - Amount of players teams are allowed to be unbalanced by
- stb_deadonly - Enable or Disable the switching of only dead players
- stb_priorityenabled - Enable or Disable the prioritization of living players
- stb_uberlevel - Min level medic must have to have priority over other players. Setting to 0 will rarely switch a living medic
- stb_switchbackforced - Amount of time in seconds to not switch a player twice and force the team if enabled
- stb_livingplayercheckdelay - Delay in seconds to start checking living players once teams become unbalanced
- stb_livingplayerswitchdelay - Delay in seconds to switch living players once selected
- stb_roundstartdelay - Delay in seconds to start balancing teams after the start of a round
- stb_adminflag - Admin flag to use for immunity. Must be in char format
- stb_buddyenabled - Enable or Disable the buddy system
- stb_buddyrestriction - Enable or Disable Admin Only buddy lists
- stb_convarcontrol - Enable or Disable the control of builtin console variables
A simpleteambalancer.cfg file will be made when first ran. It will be located in /cfgs/sourcemod
Place the simple-teambalancer.smx in the /sourcemod/plugins dir.Changelog:
Place the simple-plugins.smx in the /sourcemod/plugins dir.
Place the simpleteambalancer.phrases.txt in the /sourcemod/translations dir.
Frequently Asked Questions:
Q: How does it determine if the teams are unbalanced?
Added checks for invalid cvars
Added resetting of globals on mapstart
Added logactivity2 message for IsUnBalanced function
Purely by player count. Example: 10vs13
Q: Does it take the players score into account?
Q: Does it take the players K/D ratio into account?
Q: How does it pick a player to switch?
The plugin goes through three layers of prioritization:
Find a dead player in the following order:
- If he is an admin, skip him
- If he has been switched before, skip him
- If he has a buddy and is on the same team, skip him
- If he has a buddy and is not on the same team, switch him
- If has buildings built, skip him (TF2 Only) (stb_priorityenabled 1)
- If he is just a regular dead player, switch him
Find a living player in the following order:
- If he is an admin, skip him.
- If he has been switched before, skip him
- If he has a uber, skip him (TF2 Only) (stb_priorityenabled 1)
- If he has buildings built, skip him (TF2 Only) (stb_priorityenabled 1)
- If he has a buddy and is on the same team, skip him (stb_buddyenabled 1)
- If he has a buddy and is not on the same team, switch him (stb_buddyenabled 1)
- If he is just a regular live player, switch him
If the plugin still cannot find a player to switch, it will get a random non admin player, and switch him after the delay.
If someone dies and fits the requirements after a live player has been selected the plugin will then switch that player. With the delays involved is more than likely that a dead player with be switched before a living one. Of course, you can always increase the two delays involved to increase the odds of a dead player being switched. It is also very rare for it to have to result to finding a random living player. You can also now just have it search for dead players with the dead only cvar.
Q: Does this replace the built-in autobalancer?
Q: Do I have to disable the built-in autobalancer?
By default this plugin takes control of the console variables that control the built-in autobalancer and team balance limits. I have never been a fan of forcing changes to servers with plugins without the ability to turn it off. Therefore stb_convarcontol can turn this off. But I highly suggest you leave it on.
Q: Does disabling this plugin turn on the built-in autobalancer?
No. If you have stb_convarcontol on, it will release the console variables so you can then set them.
Q: Can someone joining the game and picking a team make the teams unbalanced?
Only if you don't let it control the built-in console variables and have a different mp_teams_unbalance_limit.
Q: Can admins join any team making the teams unbalanced?
No. Admins are immune to switches, but not the built-in team joining controls.
Q: What is a balance buddy?
A balance buddy is a person that you pair up with. It will try to keep you and your buddy on the same team.
Q: Can I have more than 1 balance buddy?
Q: Can anyone make me their balance buddy?
Depends on stb_buddyrestriction. By default only admins can select a buddy. If open to the public, than anyone can.
Q: If someone else selects me as a balance buddy does that override my selection?
Yes. You can now lock it so that only you can change your balance buddy with the command lockbuddy.
Q: Does my balance buddy remain during a map change?
No. You have to reselect your buddy on a map change.
Q: Are players forced to the team?
Yes. The player has to accept his team for five(default) mins.
Looking for additional translations! If you have or can translate the phrases, please do and post with the new translations. I will add them to the file and certainly credit you.
French - by Slipenbois
German - by gH0sTy
Hungarian - by KhyrOO
This plugin requires Simple SourceMod Plugins Core
to work. It has NOT
been included in the .zip file.
There was a problem
with the tf2.inc file that comes with sourcemod. I had to change that file in order to get it to work with other games. I included that file with my changes as well. Plugin is compiled in 1.2.3