A team balancer for TFC
When joining a team, it checks the number of human players in all teams, and only allows joining if this wouldn't unbalance the teams.
Note: Because the plugin is based on human player count, bots should be set to even the teams. With FoxBot, use these settings in file "foxbot\tfc\foxbot.cfg":
# Bot team balance (0 off, 1 on)
# Turn this on to have the bots auto switch when teams become uneven
# Bot to human balance (0 off, 1 on)
# Turn this on to balance the teams in a bot to human ratio (May be buggy)
Unbalanced teams can still happen by players leaving or joining the spectator team.
The human-to-human ratio can get messed up if people use auto assign while bots are present.
(This is fixed in the beta.)
stb_on (1/0) - enable the plugin (default: 1)
stb_teams (1 .. 4) - number of teams the current map has (default: 2)
stb_version - version number (visible in server rules)
Simple team balance plugin for TFC
Can be configured to work with 4 teams via cvar (stb_teams).
Put stb_teams "4" into the corresponding map cfg file (e.g. rats).
For maps where the teams are supposed to be uneven (e.g. the TFC map "hunted"),
the plugin can be disabled via map cfg file. Put stb_on "0" into the map cfg in
Admins with immunity can switch to any team.
tfc_autoteam should be disabled when there are bots (but can be enabled for maps
like hunted), because the plugin is based on human players, which tfc_autoteam
If the cvars are changed in map configs, then the default values for the cvars
should be put into amxx.cfg or server.cfg. Else the cvars will not reset to
default after map change.
Note that only the beta is compatible with maps which feature uneven teams, e.g. hunted, ukfootie. All other plugins (stb, utw, fts) need to be configured as described above!
No need for map specific configs
Available teams and team size limits are detected automatically, map specific configs setting stb_on and stb_teams aren't necessary any more.
Handling auto assign prevents human players getting stacked in one team when bots are present.
0 = let TFC handle auto assign
1 = move player to the team with the least humans (default)
2 = disable auto assign
Only check immunity if this cvar is "true" (1), which is the default.
Debug infos in console and hint in chat, off by default.
Announcement if teams are uneven (EDIT: This is currently implemented as an alternative plugin (UTW - uneven teams warning).)
When a player selects auto assign (5), this command should be blocked / exchanged with the appropriate team according to human count. (Since auto assign doesn't differentiate between bots and humans.) (EDIT: This is currently in beta.)
Determine number of teams through pfn_keyvalue forward / function copy_keyvalue. Check which teams are used by spawns (entity class info_player_teamspawn), check entity (class) info_tfdetect for team size limits. (EDIT: This is currently in beta.)
- "Team switch denied" sound (like the Admin Mod plugin)
Optional forced switching if teams become uneven Use "fts" plugin instead of "utw".
- Perhaps a vote trigger to allow a humans vs. bots mode.
- Optionally ignoring admin immunity (cvar).
Scramble / shuffle teams
(There's probably more to do which I don't remember right now.)