From 82108a7fcdb935ba2ccdc65cde827ce6cf41bcc7 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sun, 16 Sep 2007 02:36:49 +0000 Subject: [PATCH] fixed up the CheckCommandAccess() logic a bit --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401435 --- core/smn_console.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/core/smn_console.cpp b/core/smn_console.cpp index 1070fbc4..9ef2fc8a 100644 --- a/core/smn_console.cpp +++ b/core/smn_console.cpp @@ -39,6 +39,7 @@ #include "sm_stringutil.h" #include "PlayerManager.h" #include "ChatTriggers.h" +#include "AdminCache.h" #include #include @@ -979,11 +980,17 @@ static cell_t CheckCommandAccess(IPluginContext *pContext, const cell_t *params) char *cmd; pContext->LocalToString(params[2], &cmd); - /* Support the newer version which will auto-check for an existing command. */ + /* Auto-detect a command if we can */ FlagBits bits = params[3]; - if (params[0] == 4 && params[4]) + bool found_command = false; + if (params[0] < 4 || !params[4]) { - g_ConCmds.LookForCommandAdminFlags(cmd, &bits); + found_command = g_ConCmds.LookForCommandAdminFlags(cmd, &bits); + } + + if (!found_command) + { + g_Admins.GetCommandOverride(cmd, Override_Command, &bits); } return g_ConCmds.CheckCommandAccess(params[1], cmd, bits) ? 1 : 0;