]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Prevent using tell command while connecting, also disallow private messaging players...
authorMario <mario@smbclan.net>
Tue, 14 Feb 2017 08:37:55 +0000 (18:37 +1000)
committerMario <mario@smbclan.net>
Tue, 14 Feb 2017 08:37:55 +0000 (18:37 +1000)
qcsrc/server/command/cmd.qc
qcsrc/server/player.qc

index a4145abef0b10cfd658667fbadb3b6bf36600563..91030beacd74a171f54c37c1dcf75141d467c3ff 100644 (file)
@@ -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);
 
index 5e581c2bd45a06fca4acf31553599390e491b4ae..e6e9f481f635ae5e1682897268b1f7b3a2a6e910 100644 (file)
@@ -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);