From: Mario Date: Tue, 14 Feb 2017 08:37:55 +0000 (+1000) Subject: Prevent using tell command while connecting, also disallow private messaging players... X-Git-Tag: xonotic-v0.8.2~210 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c3d880be2157f58d2b9e8d1ad2758e9105177888;p=xonotic%2Fxonotic-data.pk3dir.git Prevent using tell command while connecting, also disallow private messaging players when g_chat_nospectators is enabled --- 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);