Move the SetCommandClient hook into GameHooks.

This commit is contained in:
David Anderson
2015-09-09 20:03:23 -07:00
parent c54b54ded0
commit fe16e8e47c
8 changed files with 40 additions and 39 deletions
+6 -9
View File
@@ -103,11 +103,11 @@ void ChatTriggers::OnSourceModGameInitialized()
{
ConCommand *say_team = FindCommand("say_team");
CommandHook::Callback pre_hook = [this] (const ICommandArgs *args) -> bool {
return this->OnSayCommand_Pre(args);
CommandHook::Callback pre_hook = [this] (int client, const ICommandArgs *args) -> bool {
return this->OnSayCommand_Pre(client, args);
};
CommandHook::Callback post_hook = [this] (const ICommandArgs *args) -> bool {
return this->OnSayCommand_Post(args);
CommandHook::Callback post_hook = [this] (int client, const ICommandArgs *args) -> bool {
return this->OnSayCommand_Post(client, args);
};
if (ConCommand *say = FindCommand("say")) {
@@ -145,9 +145,8 @@ void ChatTriggers::OnSourceModShutdown()
forwardsys->ReleaseForward(m_pOnClientSayCmd_Post);
}
bool ChatTriggers::OnSayCommand_Pre(const ICommandArgs *command)
bool ChatTriggers::OnSayCommand_Pre(int client, const ICommandArgs *command)
{
int client = g_ConCmds.GetCommandClient();
m_bIsChatTrigger = false;
m_bWasFloodedMessage = false;
m_bPluginIgnored = true;
@@ -287,10 +286,8 @@ bool ChatTriggers::OnSayCommand_Pre(const ICommandArgs *command)
return false;
}
bool ChatTriggers::OnSayCommand_Post(const ICommandArgs *command)
bool ChatTriggers::OnSayCommand_Post(int client, const ICommandArgs *command)
{
int client = g_ConCmds.GetCommandClient();
if (m_bWillProcessInPost)
{
/* Reset this for re-entrancy */