1.1 --- a/core/ChatTriggers.cpp Fri Aug 23 07:28:07 2013 -0400
1.2 +++ b/core/ChatTriggers.cpp Fri Aug 23 07:31:04 2013 -0400
1.3 @@ -208,9 +208,27 @@
1.4 m_bWasFloodedMessage = false;
1.5 m_bPluginIgnored = false;
1.6
1.7 + const char *args = command.ArgS();
1.8 +
1.9 + if (!args)
1.10 + {
1.11 + RETURN_META(MRES_IGNORED);
1.12 + }
1.13 +
1.14 + /* Save these off for post hook as the command data returned from the engine in older engine versions
1.15 + * can be NULL, despite the data still being there and valid. */
1.16 + m_Arg0Backup = command.Arg(0);
1.17 + m_ArgSBackup = command.ArgS();
1.18 +
1.19 /* The server console cannot do this */
1.20 if (client == 0)
1.21 {
1.22 + cell_t res = CallOnClientSayCommand(client);
1.23 + if (res >= Pl_Handled)
1.24 + {
1.25 + m_bPluginIgnored = (res >= Pl_Stop);
1.26 + RETURN_META(MRES_SUPERCEDE);
1.27 + }
1.28 RETURN_META(MRES_IGNORED);
1.29 }
1.30
1.31 @@ -222,13 +240,6 @@
1.32 RETURN_META(MRES_IGNORED);
1.33 }
1.34
1.35 - const char *args = command.ArgS();
1.36 -
1.37 - if (!args)
1.38 - {
1.39 - RETURN_META(MRES_IGNORED);
1.40 - }
1.41 -
1.42 /* Check if we need to block this message from being sent */
1.43 if (ClientIsFlooding(client))
1.44 {
1.45 @@ -256,11 +267,6 @@
1.46 is_quoted = true;
1.47 }
1.48
1.49 - /* Save these off for post hook as the command data returned from the engine in older engine versions
1.50 - * can be NULL, despite the data still being there and valid. */
1.51 - m_Arg0Backup = command.Arg(0);
1.52 - m_ArgSBackup = command.ArgS();
1.53 -
1.54 #if SOURCE_ENGINE == SE_EPISODEONE
1.55 if (m_bIsINS && strcmp(m_Arg0Backup, "say2") == 0 && strlen(args) >= 4)
1.56 {
1.57 @@ -300,11 +306,7 @@
1.58
1.59 if (m_pOnClientSayCmd->GetFunctionCount() != 0)
1.60 {
1.61 - cell_t res = Pl_Continue;
1.62 - m_pOnClientSayCmd->PushCell(client);
1.63 - m_pOnClientSayCmd->PushString(m_Arg0Backup);
1.64 - m_pOnClientSayCmd->PushString(m_ArgSBackup);
1.65 - m_pOnClientSayCmd->Execute(&res);
1.66 + cell_t res = CallOnClientSayCommand(client);
1.67
1.68 if (res >= Pl_Handled)
1.69 {
1.70 @@ -438,6 +440,16 @@
1.71 return true;
1.72 }
1.73
1.74 +cell_t ChatTriggers::CallOnClientSayCommand(int client)
1.75 +{
1.76 + cell_t res = Pl_Continue;
1.77 + m_pOnClientSayCmd->PushCell(client);
1.78 + m_pOnClientSayCmd->PushString(m_Arg0Backup);
1.79 + m_pOnClientSayCmd->PushString(m_ArgSBackup);
1.80 + m_pOnClientSayCmd->Execute(&res);
1.81 + return res;
1.82 +}
1.83 +
1.84 unsigned int ChatTriggers::SetReplyTo(unsigned int reply)
1.85 {
1.86 unsigned int old = m_ReplyTo;