From b69be014f3d800addd9230332322cb4a4e4c4806 Mon Sep 17 00:00:00 2001 From: z411 Date: Thu, 8 Oct 2020 21:49:17 -0300 Subject: [PATCH] Not sending events when playing chat sounds --- qcsrc/server/client.qc | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index e3eabdcc8..80c0a7ea3 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -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) -- 2.39.2