Fixed crash in OnSayCommand_Post with console chat, pass console chat (bug 5864, r=kyles).
This commit is contained in:
parent
8860e18026
commit
a2aa5d1cda
@ -208,9 +208,27 @@ void ChatTriggers::OnSayCommand_Pre()
|
||||
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 @@ void ChatTriggers::OnSayCommand_Pre()
|
||||
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 @@ void ChatTriggers::OnSayCommand_Pre()
|
||||
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 @@ void ChatTriggers::OnSayCommand_Pre()
|
||||
|
||||
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)
|
||||
{
|
||||
@ -432,6 +434,16 @@ bool ChatTriggers::PreProcessTrigger(edict_t *pEdict, const char *args, bool is_
|
||||
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;
|
||||
|
@ -69,6 +69,7 @@ public:
|
||||
private:
|
||||
bool PreProcessTrigger(edict_t *pEdict, const char *args, bool is_quoted);
|
||||
bool ClientIsFlooding(int client);
|
||||
cell_t CallOnClientSayCommand(int client);
|
||||
private:
|
||||
ConCommand *m_pSayCmd;
|
||||
ConCommand *m_pSayTeamCmd;
|
||||
|
Loading…
Reference in New Issue
Block a user