]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Not sending events when playing chat sounds
authorz411 <z411@omaera.org>
Fri, 9 Oct 2020 00:49:17 +0000 (21:49 -0300)
committerz411 <z411@omaera.org>
Fri, 9 Oct 2020 00:49:17 +0000 (21:49 -0300)
qcsrc/server/client.qc

index e3eabdcc8d0321995dbdb483e5041e02f02ecabc..80c0a7ea379daae898e0b3f42292f07f0844c733 100644 (file)
@@ -3175,8 +3175,9 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc
                        FOREACH_CLIENT(!(IS_PLAYER(it) || it.caplayer) && IS_REAL_CLIENT(it) && it != source && !MUTATOR_CALLHOOK(ChatMessageTo, it, source), {
                                sprint(it, msgstr);
                        });
-                       play_chatsound(source, msgin);
-                       event_log_msg = sprintf(":chat_spec:%d:%s", source.playerid, strreplace("\n", " ", msgin));
+                       
+                       if(play_chatsound(source, msgin))
+                               event_log_msg = sprintf(":chat_spec:%d:%s", source.playerid, strreplace("\n", " ", msgin));
                }
                else
                {
@@ -3188,8 +3189,9 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc
                        FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != source && !MUTATOR_CALLHOOK(ChatMessageTo, it, source), {
                                sprint(it, msgstr);
                        });
-                       play_chatsound(source, msgin);
-                       event_log_msg = sprintf(":chat:%d:%s", source.playerid, strreplace("\n", " ", msgin));
+                       
+                       if(play_chatsound(source, msgin))
+                               event_log_msg = sprintf(":chat:%d:%s", source.playerid, strreplace("\n", " ", msgin));
                }
        }
 
@@ -3197,12 +3199,10 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc
                GameLogEcho(event_log_msg);
        }
        
-       
-
        return ret;
 }
 
-void play_chatsound(entity source, string msgin)
+bool play_chatsound(entity source, string msgin)
 {
        if(autocvar_g_chat_sounds) {
                var .float flood_sound = floodcontrol_chatsound;
@@ -3216,11 +3216,14 @@ void play_chatsound(entity source, string msgin)
                        //bprintf("msg is %s and list is %s\n", rawmsg, autocvar_g_chat_sounds_list);
                        if (findinlist_abbrev(rawmsg, autocvar_g_chat_sounds_list)) {
                                play2all(strcat("sound/chat/", rawmsg, ".ogg"));
-                               
                                source.(flood_sound) = time;
+                               
+                               return true;
                        }
                }
        }
+       
+       return false;
 }
 // hack to copy the button fields from the client entity to the Client State
 void PM_UpdateButtons(entity this, entity store)