From 457de6e8b35e8eaf0cfaea07654e7b719da1900f Mon Sep 17 00:00:00 2001 From: terencehill Date: Fri, 7 Sep 2018 13:21:19 +0200 Subject: [PATCH] Clan Arena: fix team chat (was considered spectator chat for killed players) and real spectators chat (sending messages to killed players too) This commit reverts d46f774178 --- qcsrc/server/command/cmd.qc | 12 ------------ qcsrc/server/player.qc | 14 +++++++------- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index a5867dced..1b398a8b2 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -363,19 +363,7 @@ void ClientCommand_say_team(entity caller, int request, int argc, string command case CMD_REQUEST_COMMAND: { if (argc >= 2) - { - string _classname = string_null; - if (!IS_PLAYER(caller) && caller.caplayer) - { - // CA: make work team chat for killed players - _classname = caller.classname; - caller.classname = STR_PLAYER; - } - Say(caller, true, NULL, substring(command, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), 1); - if (_classname) - caller.classname = _classname; - } return; // never fall through to usage } diff --git a/qcsrc/server/player.qc b/qcsrc/server/player.qc index 5d69c0aa1..e211e16dd 100644 --- a/qcsrc/server/player.qc +++ b/qcsrc/server/player.qc @@ -692,7 +692,7 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc msgin = formatmessage(source, msgin); string colorstr; - if (!IS_PLAYER(source)) + if (!(IS_PLAYER(source) || source.caplayer)) colorstr = "^0"; // black for spectators else if(teamplay) colorstr = Team_ColorCode(source.team); @@ -874,7 +874,7 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc sourcecmsgstr = cmsgstr; } - if (!privatesay && source && !IS_PLAYER(source)) + if (!privatesay && source && !(IS_PLAYER(source) || source.caplayer)) { if (!game_stopped) if (teamsay || (autocvar_g_chat_nospectators == 1) || (autocvar_g_chat_nospectators == 2 && !warmup_stage)) @@ -909,10 +909,10 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc ret = 1; } - if (privatesay && source && !IS_PLAYER(source)) + if (privatesay && source && !(IS_PLAYER(source) || source.caplayer)) { if (!game_stopped) - if ((privatesay && IS_PLAYER(privatesay)) && ((autocvar_g_chat_nospectators == 1) || (autocvar_g_chat_nospectators == 2 && !warmup_stage))) + if ((privatesay && (IS_PLAYER(privatesay) || privatesay.caplayer)) && ((autocvar_g_chat_nospectators == 1) || (autocvar_g_chat_nospectators == 2 && !warmup_stage))) ret = -1; // just hide the message completely } @@ -950,7 +950,7 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc dedicated_print(msgstr); // send to server console too if(sourcecmsgstr != "") centerprint(source, sourcecmsgstr); - FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && it != source && it.team == source.team && !MUTATOR_CALLHOOK(ChatMessageTo, it, source), { + FOREACH_CLIENT((IS_PLAYER(it) || it.caplayer) && IS_REAL_CLIENT(it) && it != source && it.team == source.team && !MUTATOR_CALLHOOK(ChatMessageTo, it, source), { sprint(it, msgstr); if(cmsgstr != "") centerprint(it, cmsgstr); @@ -960,7 +960,7 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc { sprint(source, sourcemsgstr); dedicated_print(msgstr); // send to server console too - FOREACH_CLIENT(!IS_PLAYER(it) && IS_REAL_CLIENT(it) && it != source && !MUTATOR_CALLHOOK(ChatMessageTo, it, source), sprint(it, msgstr)); + FOREACH_CLIENT(!(IS_PLAYER(it) || it.caplayer) && IS_REAL_CLIENT(it) && it != source && !MUTATOR_CALLHOOK(ChatMessageTo, it, source), sprint(it, msgstr)); } else { @@ -969,7 +969,7 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc dedicated_print(msgstr); // send to server console too MX_Say(strcat(playername(source, true), "^7: ", msgin)); } - FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != source && !MUTATOR_CALLHOOK(ChatMessageTo, it, source), sprint(it, msgstr)); + FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != source && !MUTATOR_CALLHOOK(ChatMessageTo, it, source), sprint(it, msgstr)); } } -- 2.39.2