]> git.rm.cloudns.org Git - voretournament/voretournament.git/commitdiff
Add a cvar to allow forcing the player in a given team in campaign mode. Necessary...
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 15 Sep 2010 13:04:04 +0000 (16:04 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 15 Sep 2010 13:04:04 +0000 (16:04 +0300)
data/defaultVoretournament.cfg
data/qcsrc/server/teamplay.qc

index 0b05436e067b01fabc64d84a524722ec5927e4dd..750056b844617947e205e0866deb83d774158a16 100644 (file)
@@ -892,6 +892,7 @@ set quit_and_redirect ""    "set to an IP to redirect all players at the end of the
 \r
 // singleplayer campaign\r
 set g_campaign 0\r
+set g_campaign_forceteam 0 "Forces the player to a given team in campaign mode, 1 = red, 2 = blue, 3 = yellow, 4 = pink"\r
 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)"\r
 seta g_campaign_name "voretournament"\r
 set g_campaign_skill 0\r
index b2f8fbf0294eb1f25082cd822ee3144ba7ed5dc0..297cdb1e994f3be2cb9cdda6e65328fdebdd49eb 100644 (file)
@@ -827,6 +827,29 @@ float JoinBestTeam(entity pl, float only_return_best, float forcebestteam)
        // find out what teams are available\r
        CheckAllowedTeams(pl);\r
 \r
+       // if we want the player in a certain team for campaign, force him there\r
+       if(cvar("g_campaign"))\r
+       if(clienttype(pl) == CLIENTTYPE_REAL) // only players, not bots\r
+       {\r
+               switch(cvar("g_campaign_forceteam"))\r
+               {\r
+                       case 1:\r
+                               SetPlayerColors(pl, COLOR_TEAM1 - 1);\r
+                               return COLOR_TEAM1;\r
+                       case 2:\r
+                               SetPlayerColors(pl, COLOR_TEAM2 - 1);\r
+                               return COLOR_TEAM2;\r
+                       case 3:\r
+                               SetPlayerColors(pl, COLOR_TEAM3 - 1);\r
+                               return COLOR_TEAM3;\r
+                       case 4:\r
+                               SetPlayerColors(pl, COLOR_TEAM4 - 1);\r
+                               return COLOR_TEAM4;\r
+                       default:\r
+                               break;\r
+               }\r
+       }\r
+\r
        // if we don't care what team he ends up on, put him on whatever team he entered as.\r
        // if he's not on a valid team, then let other code put him on the smallest team\r
        if(!forcebestteam)\r