Merge remote-tracking branch 'origin/terencehill/g_changeteam_banned_fix'
authorRudolf Polzer <divverent@alientrap.org>
Mon, 12 Dec 2011 08:44:27 +0000 (09:44 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Mon, 12 Dec 2011 08:44:27 +0000 (09:44 +0100)
1  2 
qcsrc/server/clientcommands.qc

index b62f34f23320de68f6e46cf0dbe4ce8b366244f5,1c8b59facee90ba1228724239a499e5c4961d243..7f52f8f8c951fe3161eee840a2fcaf2d1dcab53c
@@@ -278,25 -278,33 +278,33 @@@ void SV_ParseClientCommand(string s) 
                } else if(lockteams) {
                        sprint( self, "^7The game has already begun, you must wait until the next map to be able to join a team.\n");
                } else if( argv(1) == "red" ) {
-                       if(self.team != COLOR_TEAM1 || self.deadflag != DEAD_NO)
-                               ClientKill_TeamChange(COLOR_TEAM1);
-                       else
+                       if(self.team == COLOR_TEAM1 && self.deadflag == DEAD_NO)
                                sprint( self, "^7You already are on that team.\n");
-               } else if( argv(1) == "blue" ) {
-                       if(self.team != COLOR_TEAM2 || self.deadflag != DEAD_NO)
-                               ClientKill_TeamChange(COLOR_TEAM2);
+                       else if (self.wasplayer && autocvar_g_changeteam_banned)
+                               sprint( self, "^1You cannot change team, forbidden by the server.\n");
                        else
+                               ClientKill_TeamChange(COLOR_TEAM1);
+               } else if( argv(1) == "blue" ) {
+                       if(self.team == COLOR_TEAM2 && self.deadflag == DEAD_NO)
                                sprint( self, "^7You already are on that team.\n");
-               } else if( argv(1) == "yellow" ) {
-                       if(self.team != COLOR_TEAM3 || self.deadflag != DEAD_NO)
-                               ClientKill_TeamChange(COLOR_TEAM3);
+                       else if (self.wasplayer && autocvar_g_changeteam_banned)
+                               sprint( self, "^1You cannot change team, forbidden by the server.\n");
                        else
+                               ClientKill_TeamChange(COLOR_TEAM2);
+               } else if( argv(1) == "yellow" ) {
+                       if(self.team == COLOR_TEAM3 && self.deadflag == DEAD_NO)
                                sprint( self, "^7You already are on that team.\n");
-               } else if( argv(1) == "pink" ) {
-                       if(self.team != COLOR_TEAM4 || self.deadflag != DEAD_NO)
-                               ClientKill_TeamChange(COLOR_TEAM4);
+                       else if (self.wasplayer && autocvar_g_changeteam_banned)
+                               sprint( self, "^1You cannot change team, forbidden by the server.\n");
                        else
+                               ClientKill_TeamChange(COLOR_TEAM3);
+               } else if( argv(1) == "pink" ) {
+                       if(self.team == COLOR_TEAM4 && self.deadflag == DEAD_NO)
                                sprint( self, "^7You already are on that team.\n");
+                       else if (self.wasplayer && autocvar_g_changeteam_banned)
+                               sprint( self, "^1You cannot change team, forbidden by the server.\n");
+                       else
+                               ClientKill_TeamChange(COLOR_TEAM4);
                } else if( argv(1) == "auto" ) {
                        ClientKill_TeamChange(-1);
                } else {
                if(cmd_argc >= 2)
                        Say(self, TRUE, world, substring(s, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), 1);
                //clientcommand(self, formatmessage(s));
 +      } else if(cmd_name == "selfstuff") {
 +              // this command mainly serves to embed a command to be executed into a demo (HINT: use settemp)
 +              stuffcmd(self, substring(s, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)));
        } else if(cmd_name == "tell") {
                e = GetCommandPlayerSlotTargetFromTokenizedCommand(cmd_argc, 1);
                if(e && cmd_argc > ParseCommandPlayerSlotTarget_firsttoken)
                }
                //clientcommand(self, formatmessage(s));
        } else if(cmd_name == "info") {
 -              cmd_name = cvar_string_builtin(strcat("sv_info_", argv(1))); // This needed fixed for the cvar check
 +              cmd_name = builtin_cvar_string(strcat("sv_info_", argv(1))); // This needed fixed for the cvar check
                if(cmd_name == "")
                        sprint(self, "ERROR: unsupported info command\n");
                else