diff -r 72a666cb56df -r 8bc2d9569803 core/ChatTriggers.cpp --- a/core/ChatTriggers.cpp Fri Aug 23 07:28:07 2013 -0400 +++ b/core/ChatTriggers.cpp Fri Aug 23 07:31:04 2013 -0400 @@ -208,9 +208,27 @@ m_bWasFloodedMessage = false; m_bPluginIgnored = false; + const char *args = command.ArgS(); + + if (!args) + { + RETURN_META(MRES_IGNORED); + } + + /* Save these off for post hook as the command data returned from the engine in older engine versions + * can be NULL, despite the data still being there and valid. */ + m_Arg0Backup = command.Arg(0); + m_ArgSBackup = command.ArgS(); + /* The server console cannot do this */ if (client == 0) { + cell_t res = CallOnClientSayCommand(client); + if (res >= Pl_Handled) + { + m_bPluginIgnored = (res >= Pl_Stop); + RETURN_META(MRES_SUPERCEDE); + } RETURN_META(MRES_IGNORED); } @@ -222,13 +240,6 @@ RETURN_META(MRES_IGNORED); } - const char *args = command.ArgS(); - - if (!args) - { - RETURN_META(MRES_IGNORED); - } - /* Check if we need to block this message from being sent */ if (ClientIsFlooding(client)) { @@ -256,11 +267,6 @@ is_quoted = true; } - /* Save these off for post hook as the command data returned from the engine in older engine versions - * can be NULL, despite the data still being there and valid. */ - m_Arg0Backup = command.Arg(0); - m_ArgSBackup = command.ArgS(); - #if SOURCE_ENGINE == SE_EPISODEONE if (m_bIsINS && strcmp(m_Arg0Backup, "say2") == 0 && strlen(args) >= 4) { @@ -300,11 +306,7 @@ if (m_pOnClientSayCmd->GetFunctionCount() != 0) { - cell_t res = Pl_Continue; - m_pOnClientSayCmd->PushCell(client); - m_pOnClientSayCmd->PushString(m_Arg0Backup); - m_pOnClientSayCmd->PushString(m_ArgSBackup); - m_pOnClientSayCmd->Execute(&res); + cell_t res = CallOnClientSayCommand(client); if (res >= Pl_Handled) { @@ -438,6 +440,16 @@ return true; } +cell_t ChatTriggers::CallOnClientSayCommand(int client) +{ + cell_t res = Pl_Continue; + m_pOnClientSayCmd->PushCell(client); + m_pOnClientSayCmd->PushString(m_Arg0Backup); + m_pOnClientSayCmd->PushString(m_ArgSBackup); + m_pOnClientSayCmd->Execute(&res); + return res; +} + unsigned int ChatTriggers::SetReplyTo(unsigned int reply) { unsigned int old = m_ReplyTo;