From: MirceaKitsune Date: Wed, 15 Sep 2010 13:04:04 +0000 (+0300) Subject: Add a cvar to allow forcing the player in a given team in campaign mode. Necessary... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=296c7e0aabba6a52fab753dcb6565a22cc83df97;p=voretournament%2Fvoretournament.git Add a cvar to allow forcing the player in a given team in campaign mode. Necessary at least for my campaign. --- diff --git a/data/defaultVoretournament.cfg b/data/defaultVoretournament.cfg index 0b05436e..750056b8 100644 --- a/data/defaultVoretournament.cfg +++ b/data/defaultVoretournament.cfg @@ -892,6 +892,7 @@ set quit_and_redirect "" "set to an IP to redirect all players at the end of the // singleplayer campaign set g_campaign 0 +set g_campaign_forceteam 0 "Forces the player to a given team in campaign mode, 1 = red, 2 = blue, 3 = yellow, 4 = pink" set g_campaign_changelevel 0 "When disabled, levels won't be automatically change after a match was won or lost (you're taken back to the menu instead)" seta g_campaign_name "voretournament" set g_campaign_skill 0 diff --git a/data/qcsrc/server/teamplay.qc b/data/qcsrc/server/teamplay.qc index b2f8fbf0..297cdb1e 100644 --- a/data/qcsrc/server/teamplay.qc +++ b/data/qcsrc/server/teamplay.qc @@ -827,6 +827,29 @@ float JoinBestTeam(entity pl, float only_return_best, float forcebestteam) // find out what teams are available CheckAllowedTeams(pl); + // if we want the player in a certain team for campaign, force him there + if(cvar("g_campaign")) + if(clienttype(pl) == CLIENTTYPE_REAL) // only players, not bots + { + switch(cvar("g_campaign_forceteam")) + { + case 1: + SetPlayerColors(pl, COLOR_TEAM1 - 1); + return COLOR_TEAM1; + case 2: + SetPlayerColors(pl, COLOR_TEAM2 - 1); + return COLOR_TEAM2; + case 3: + SetPlayerColors(pl, COLOR_TEAM3 - 1); + return COLOR_TEAM3; + case 4: + SetPlayerColors(pl, COLOR_TEAM4 - 1); + return COLOR_TEAM4; + default: + break; + } + } + // if we don't care what team he ends up on, put him on whatever team he entered as. // if he's not on a valid team, then let other code put him on the smallest team if(!forcebestteam)