Fix half part of #2191: 'Player is now spectating' isn't shown in teamless games...
authorterencehill <piuntn@gmail.com>
Sat, 19 Jan 2019 22:45:12 +0000 (23:45 +0100)
committerterencehill <piuntn@gmail.com>
Sat, 19 Jan 2019 22:45:12 +0000 (23:45 +0100)
qcsrc/server/client.qc
qcsrc/server/teamplay.qc

index fe0c041..c5d9854 100644 (file)
@@ -381,7 +381,7 @@ void PutObserverInServer(entity this)
                if(axh.owner == this && axh != NULL && !wasfreed(axh))
                        delete(axh);
        }
-       
+
        if (mutator_returnvalue)
        {
                // mutator prevents resetting teams+score
@@ -390,7 +390,9 @@ void PutObserverInServer(entity this)
        {
                SetPlayerTeam(this, -1, TEAM_CHANGE_SPECTATOR);
                this.frags = FRAGS_SPECTATOR;
-    }
+       }
+       if (CS(this).just_joined)
+               CS(this).just_joined = false;
 }
 
 int player_getspecies(entity this)
index a301036..d9682ed 100644 (file)
@@ -227,10 +227,6 @@ bool SetPlayerTeam(entity player, int team_index, int type)
                                Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_QUIT_SPECTATE,
                                        player.netname);
                        }
-                       else
-                       {
-                               CS(player).just_joined = false;
-                       }
                }
                KillPlayerForTeamChange(player);
                if (!IS_BOT_CLIENT(player))
@@ -238,6 +234,11 @@ bool SetPlayerTeam(entity player, int team_index, int type)
                        TeamBalance_AutoBalanceBots();
                }
        }
+       else if (team_index == -1)
+       {
+               if (!CS(player).just_joined)
+                       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_QUIT_SPECTATE, player.netname);
+       }
        return true;
 }