]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/command/cmd.qc
Merge branch 'master' into Mario/notifications
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / command / cmd.qc
index 51a04b59135e01e3ac0fd9b6bd62c1d25271651f..898e7db18faf59a78afe5988320a8a21baa02ccb 100644 (file)
@@ -150,8 +150,10 @@ void ClientCommand_join(float request)
                {
                        if(IS_CLIENT(self))
                        {
-                               if(!IS_PLAYER(self) && !lockteams)
+                               if(!IS_PLAYER(self) && !lockteams && !gameover)
                                {
+                                       if(self.caplayer)
+                                               return;
                                        if(nJoinAllowed(self))
                                        {
                                                if(autocvar_g_campaign) { campaign_bots_may_start = 1; }
@@ -466,7 +468,7 @@ void ClientCommand_selectteam(float request, float argc)
                                                                                        GetTeamCounts(self);
                                                                                        if(!TeamSmallerEqThanTeam(Team_TeamToNumber(selection), Team_TeamToNumber(self.team), self))
                                                                                        {
-                                                                                               sprint(self, "Cannot change to a larger/better/shinier team\n");
+                                                                                               Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_TEAMCHANGE_LARGERTEAM);
                                                                                                return;
                                                                                        }
                                                                                }
@@ -580,15 +582,11 @@ void ClientCommand_spectate(float request)
                                        }
                                }
 
-                               if(IS_PLAYER(self) && autocvar_sv_spectate == 1)
-                                       ClientKill_TeamChange(-2); // observe
-
-                               // in CA, allow a dead player to move to spectators (without that, caplayer!=0 will be moved back to the player list)
-                               // note: if arena game mode is ever done properly, this needs to be removed.
-                               if(self.caplayer && (IS_SPEC(self) || IS_OBSERVER(self)))
+                               if((IS_PLAYER(self) || self.caplayer) && autocvar_sv_spectate == 1)
                                {
-                                       sprint(self, "WARNING: you will spectate in the next round.\n");
-                                       self.caplayer = 0;
+                                       if(self.caplayer && (IS_SPEC(self) || IS_OBSERVER(self)))
+                                               Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_CA_LEAVE);
+                                       ClientKill_TeamChange(-2); // observe
                                }
                        }
                        return; // never fall through to usage