h1-mod/data/cdata/scripts/mp/team_balance.gsc
2023-12-25 09:24:46 -06:00

30 lines
800 B
Plaintext

init()
{
// define the auto balance string in the game array (referenced in gsc dump, but not defined past IW6?)
precachestring(&"MP_AUTOBALANCE_NOW");
game["strings"]["autobalance"] = &"MP_AUTOBALANCE_NOW";
// define onteamselection callback function used in balanceteams()
level.onteamselection = ::set_team;
}
set_team(team)
{
if (team != self.pers["team"])
{
self.switching_teams = true;
self.joining_team = team;
self.leaving_team = self.pers["team"];
}
if (self.sessionstate == "playing")
{
self suicide();
}
self maps\mp\gametypes\_menus::addtoteam(team);
self maps\mp\gametypes\_menus::endrespawnnotify();
self maps\mp\gametypes\_teams::updateteamtime(); // defines pers["teamTime"] for balancing
}