From d0e071fc9e37689144c29b04d2c5c33717e009c6 Mon Sep 17 00:00:00 2001 From: Lyberta Date: Mon, 30 Jul 2018 23:38:20 +0300 Subject: [PATCH] Teamplay: Added proper messages when joining spectator team. --- notifications.cfg | 2 +- qcsrc/common/notifications/all.inc | 2 +- qcsrc/server/client.qc | 26 ++++++++++++++------------ qcsrc/server/teamplay.qc | 12 ++++++++++-- 4 files changed, 26 insertions(+), 16 deletions(-) diff --git a/notifications.cfg b/notifications.cfg index 143b5c0e2..11a42fc9a 100644 --- a/notifications.cfg +++ b/notifications.cfg @@ -261,7 +261,7 @@ seta notification_INFO_POWERUP_STRENGTH "1" "0 = off, 1 = print to console, 2 = seta notification_INFO_QUIT_DISCONNECT "2" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)" seta notification_INFO_QUIT_KICK_IDLING "2" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)" seta notification_INFO_QUIT_KICK_SPECTATING "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)" -seta notification_INFO_QUIT_SPECTATE "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)" +seta notification_INFO_QUIT_SPECTATE "2" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)" seta notification_INFO_RACE_ABANDONED "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)" seta notification_INFO_RACE_FAIL_RANKED "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)" seta notification_INFO_RACE_FAIL_UNRANKED "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)" diff --git a/qcsrc/common/notifications/all.inc b/qcsrc/common/notifications/all.inc index db0e0503f..9c352c4e1 100644 --- a/qcsrc/common/notifications/all.inc +++ b/qcsrc/common/notifications/all.inc @@ -422,7 +422,7 @@ MSG_INFO_NOTIF(QUIT_KICK_IDLING, N_CHATCON, 1, 0, "s1", "", "", _("^BG%s^F3 was kicked for idling"), "") MSG_INFO_NOTIF(QUIT_KICK_SPECTATING, N_CONSOLE, 0, 0, "", "", "", _("^F2You were kicked from the server because you are a spectator and spectators aren't allowed at the moment."), "") MSG_INFO_NOTIF(QUIT_KICK_TEAMKILL, N_CHATCON, 1, 0, "s1", "", "", _("^BG%s^F3 was kicked for excessive teamkilling"), "") - MSG_INFO_NOTIF(QUIT_SPECTATE, N_CONSOLE, 1, 0, "s1", "", "", _("^BG%s^F3 is now spectating"), "") + MSG_INFO_NOTIF(QUIT_SPECTATE, N_CHATCON, 1, 0, "s1", "", "", _("^BG%s^F3 is now spectating"), "") MSG_INFO_NOTIF(RACE_ABANDONED, N_CONSOLE, 1, 0, "s1", "", "", _("^BG%s^BG has abandoned the race"), "") MSG_INFO_NOTIF(RACE_FAIL_RANKED, N_CONSOLE, 1, 3, "s1 race_col f1ord race_col f3race_time race_diff", "s1 f3race_time", "race_newfail", _("^BG%s^BG couldn't break their %s%s^BG place record of %s%s %s"), "") diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 8075ff1e2..e1b883b3b 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -284,25 +284,16 @@ void PutObserverInServer(entity this) WaypointSprite_PlayerDead(this); - if (mutator_returnvalue) { - // mutator prevents resetting teams+score - } else { - Player_SetTeamIndex(this, -1); - this.frags = FRAGS_SPECTATOR; - PlayerScore_Clear(this); // clear scores when needed - } - if (CS(this).killcount != FRAGS_SPECTATOR) { - Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_QUIT_SPECTATE, this.netname); if(!game_stopped) if(autocvar_g_chat_nospectators == 1 || (!warmup_stage && autocvar_g_chat_nospectators == 2)) Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_CHAT_NOSPECTATORS); - if(!CS(this).just_joined) - LogTeamchange(this.playerid, -1, TEAM_CHANGE_SPECTATOR); - else + if(CS(this).just_joined) + { CS(this).just_joined = false; + } } accuracy_resend(this); @@ -387,6 +378,17 @@ void PutObserverInServer(entity this) if(axh.owner == this && axh != NULL && !wasfreed(axh)) delete(axh); } + + if (mutator_returnvalue) + { + // mutator prevents resetting teams+score + } + else + { + SetPlayerTeam(this, -1, TEAM_CHANGE_SPECTATOR); + this.frags = FRAGS_SPECTATOR; + PlayerScore_Clear(this); // clear scores when needed + } } int player_getspecies(entity this) diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index 79f23768e..68f4d453f 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -214,8 +214,16 @@ bool SetPlayerTeam(entity player, int team_index, int type) LogTeamchange(player.playerid, player.team, type); if (team_index != old_team_index) { - Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(player.team, - INFO_JOIN_PLAY_TEAM), player.netname); + if (team_index != -1) + { + Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM( + player.team, INFO_JOIN_PLAY_TEAM), player.netname); + } + else + { + Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_QUIT_SPECTATE, + player.netname); + } KillPlayerForTeamChange(player); } return true; -- 2.39.2