From c3d880be2157f58d2b9e8d1ad2758e9105177888 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 14 Feb 2017 18:37:55 +1000 Subject: [PATCH] Prevent using tell command while connecting, also disallow private messaging players when g_chat_nospectators is enabled --- qcsrc/server/command/cmd.qc | 6 ++++++ qcsrc/server/player.qc | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index a4145abef..91030beac 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -537,6 +537,12 @@ void ClientCommand_tell(entity caller, float request, float argc, string command { if (argc >= 3) { + if(!IS_CLIENT(caller) && IS_REAL_CLIENT(caller)) // connecting + { + print_to(caller, "You can't ^2tell^7 a message while connecting."); + return; + } + entity tell_to = GetIndexedEntity(argc, 1); float tell_accepted = VerifyClientEntity(tell_to, true, false); diff --git a/qcsrc/server/player.qc b/qcsrc/server/player.qc index 5e581c2bd..e6e9f481f 100644 --- a/qcsrc/server/player.qc +++ b/qcsrc/server/player.qc @@ -913,6 +913,13 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc ret = 1; } + if (privatesay && source && !IS_PLAYER(source)) + { + if (!game_stopped) + if ((privatesay && !IS_PLAYER(privatesay)) || (autocvar_g_chat_nospectators == 1) || (autocvar_g_chat_nospectators == 2 && !warmup_stage)) + ret = -1; // just hide the message completely + } + MUTATOR_CALLHOOK(ChatMessage, source, ret); ret = M_ARGV(1, int); -- 2.39.2