From 6b734896802520a4b27a0e15abac9e830c9f435f Mon Sep 17 00:00:00 2001 From: terencehill Date: Sat, 19 Jan 2019 23:45:12 +0100 Subject: [PATCH] Fix half part of #2191: 'Player is now spectating' isn't shown in teamless games (bug introduced by the commit 2f163ba8) --- qcsrc/server/client.qc | 6 ++++-- qcsrc/server/teamplay.qc | 9 +++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index fe0c04179..c5d985401 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -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) diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index a30103645..d9682ed6a 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -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; } -- 2.39.2