From 1eb10726877c753bff854b030305bc54efd94fdd Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 6 Jun 2007 22:26:40 +0000 Subject: [PATCH] the "No Access" phrase now replies correctly from chat triggers --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40901 --- core/ConCmdManager.cpp | 17 +++++++++++++---- core/HalfLife2.h | 3 +++ core/smn_console.cpp | 2 -- core/smn_halflife.cpp | 3 --- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/core/ConCmdManager.cpp b/core/ConCmdManager.cpp index 949bcaea..96120402 100644 --- a/core/ConCmdManager.cpp +++ b/core/ConCmdManager.cpp @@ -18,6 +18,8 @@ #include "sm_stringutil.h" #include "PlayerManager.h" #include "Translator.h" +#include "HalfLife2.h" +#include "ChatTriggers.h" ConCmdManager g_ConCmds; @@ -448,10 +450,17 @@ bool ConCmdManager::CheckAccess(int client, const char *cmd, AdminCmdInfo *pAdmi snprintf(buffer, sizeof(buffer), "You do not have access to this command"); } - char fullbuffer[192]; - snprintf(fullbuffer, sizeof(fullbuffer), "[SM] %s.\n", buffer); - - engine->ClientPrintf(player->GetEdict(), fullbuffer); + unsigned int replyto = g_ChatTriggers.GetReplyTo(); + if (replyto == SM_REPLY_CONSOLE) + { + char fullbuffer[192]; + snprintf(fullbuffer, sizeof(fullbuffer), "[SM] %s.\n", buffer); + engine->ClientPrintf(player->GetEdict(), fullbuffer); + } else if (replyto == SM_REPLY_CHAT) { + char fullbuffer[192]; + snprintf(fullbuffer, sizeof(fullbuffer), "[SM] %s.", buffer); + g_HL2.TextMsg(client, HUD_PRINTTALK, fullbuffer); + } return false; } diff --git a/core/HalfLife2.h b/core/HalfLife2.h index 3bf15692..8a7c0669 100644 --- a/core/HalfLife2.h +++ b/core/HalfLife2.h @@ -26,6 +26,9 @@ using namespace SourceHook; +#define HUD_PRINTTALK 3 +#define HUD_PRINTCENTER 4 + struct DataTableInfo { ServerClass *sc; diff --git a/core/smn_console.cpp b/core/smn_console.cpp index c792f419..aec66bb3 100644 --- a/core/smn_console.cpp +++ b/core/smn_console.cpp @@ -29,8 +29,6 @@ enum ConVarBounds ConVarBound_Lower }; -#define HUD_PRINTTALK 3 - static cell_t sm_CreateConVar(IPluginContext *pContext, const cell_t *params) { char *name, *defaultVal, *helpText; diff --git a/core/smn_halflife.cpp b/core/smn_halflife.cpp index dcadd99b..c1d6a746 100644 --- a/core/smn_halflife.cpp +++ b/core/smn_halflife.cpp @@ -19,9 +19,6 @@ #include "PlayerManager.h" #include "HalfLife2.h" -#define HUD_PRINTTALK 3 -#define HUD_PRINTCENTER 4 - IServerPluginCallbacks *g_VSP = NULL; class HalfLifeNatives : public SMGlobalClass