mirror of
https://github.com/alliedmodders/sourcemod.git
synced 2025-12-06 18:08:36 +00:00
Fix regression in 247faba that caused RegConsoleCmd to overwrite access requirements.
This commit is contained in:
parent
637941a978
commit
017fc23a98
@ -8,7 +8,7 @@
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, version 3.0, as published by the
|
||||
* Free Software Foundation.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
@ -217,7 +217,7 @@ bool ConCmdManager::InternalDispatch(int client, const ICommandArgs *args)
|
||||
/**
|
||||
* Note: Console commands will EITHER go through IServerGameDLL::ClientCommand,
|
||||
* OR this dispatch. They will NEVER go through both.
|
||||
* --
|
||||
* --
|
||||
* Whether or not it goes through the callback is determined by FCVAR_GAMEDLL
|
||||
*/
|
||||
const char *cmd = g_HL2.CurrentCommandName();
|
||||
@ -225,7 +225,7 @@ bool ConCmdManager::InternalDispatch(int client, const ICommandArgs *args)
|
||||
ConCmdInfo *pInfo = FindInTrie(cmd);
|
||||
if (pInfo == NULL)
|
||||
{
|
||||
/* Unfortunately, we now have to do a slow lookup because Valve made client commands
|
||||
/* Unfortunately, we now have to do a slow lookup because Valve made client commands
|
||||
* case-insensitive. We can't even use our sortedness.
|
||||
*/
|
||||
if (client == 0 && !engine->IsDedicatedServer())
|
||||
@ -238,8 +238,8 @@ bool ConCmdManager::InternalDispatch(int client, const ICommandArgs *args)
|
||||
pInfo = *item;
|
||||
}
|
||||
|
||||
/* This is a hack to prevent say triggers from firing on messages that were
|
||||
* blocked because of flooding. We won't remove this, but the hack will get
|
||||
/* This is a hack to prevent say triggers from firing on messages that were
|
||||
* blocked because of flooding. We won't remove this, but the hack will get
|
||||
* "nicer" when we expose explicit say hooks.
|
||||
*/
|
||||
if (g_ChatTriggers.WasFloodedMessage())
|
||||
@ -333,15 +333,15 @@ bool ConCmdManager::CheckAccess(int client, const char *cmd, AdminCmdInfo *pAdmi
|
||||
ke::SafeSprintf(fullbuffer, sizeof(fullbuffer), "[SM] %s.", buffer);
|
||||
g_HL2.TextMsg(client, HUD_PRINTTALK, fullbuffer);
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ConCmdManager::AddAdminCommand(IPluginFunction *pFunction,
|
||||
const char *name,
|
||||
bool ConCmdManager::AddAdminCommand(IPluginFunction *pFunction,
|
||||
const char *name,
|
||||
const char *group,
|
||||
int adminflags,
|
||||
const char *description,
|
||||
const char *description,
|
||||
int flags)
|
||||
{
|
||||
ConCmdInfo *pInfo = AddOrFindCommand(name, description, flags);
|
||||
@ -362,7 +362,7 @@ bool ConCmdManager::AddAdminCommand(IPluginFunction *pFunction,
|
||||
pHook->admin = new AdminCmdInfo(cmdgroup, adminflags);
|
||||
|
||||
/* First get the command group override, if any */
|
||||
bool override = adminsys->GetCommandOverride(group,
|
||||
bool override = adminsys->GetCommandOverride(group,
|
||||
Override_CommandGroup,
|
||||
&(pHook->admin->eflags));
|
||||
|
||||
@ -377,7 +377,10 @@ bool ConCmdManager::AddAdminCommand(IPluginFunction *pFunction,
|
||||
/* Assign normal flags if there were no overrides */
|
||||
if (!override)
|
||||
pHook->admin->eflags = pHook->admin->flags;
|
||||
pInfo->eflags = pHook->admin->eflags;
|
||||
|
||||
/* Only set the command's overall flags if it doesn't already require any */
|
||||
if (pInfo->eflags == 0)
|
||||
pInfo->eflags = pHook->admin->eflags;
|
||||
|
||||
cmdgroup->hooks.append(pHook);
|
||||
pInfo->hooks.append(pHook);
|
||||
@ -385,9 +388,9 @@ bool ConCmdManager::AddAdminCommand(IPluginFunction *pFunction,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ConCmdManager::AddServerCommand(IPluginFunction *pFunction,
|
||||
const char *name,
|
||||
const char *description,
|
||||
bool ConCmdManager::AddServerCommand(IPluginFunction *pFunction,
|
||||
const char *name,
|
||||
const char *description,
|
||||
int flags)
|
||||
|
||||
{
|
||||
@ -529,7 +532,7 @@ void ConCmdManager::RemoveConCmd(ConCmdInfo *info, const char *name, bool untrac
|
||||
UntrackConCommandBase(info->pCmd, this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Remove from list */
|
||||
m_CmdList.remove(info);
|
||||
|
||||
@ -570,7 +573,7 @@ ConCmdInfo *ConCmdManager::AddOrFindCommand(const char *name, const char *descri
|
||||
|
||||
if (!pCmd)
|
||||
{
|
||||
/* Note that we have to duplicate because the source might not be
|
||||
/* Note that we have to duplicate because the source might not be
|
||||
* a static string, and these expect static memory.
|
||||
*/
|
||||
if (!description)
|
||||
@ -640,7 +643,7 @@ void ConCmdManager::OnRootConsoleCommand(const char *cmdname, const ICommandArgs
|
||||
CmdHook *hook = *iter;
|
||||
if (hook->type == CmdHook::Server)
|
||||
type = "server";
|
||||
else
|
||||
else
|
||||
type = hook->info->eflags == 0 ? "console" : "admin";
|
||||
|
||||
name = hook->info->pCmd->GetName();
|
||||
@ -648,7 +651,7 @@ void ConCmdManager::OnRootConsoleCommand(const char *cmdname, const ICommandArgs
|
||||
help = hook->helptext.chars();
|
||||
else
|
||||
help = hook->info->pCmd->GetHelpText();
|
||||
UTIL_ConsolePrint(" %-17.16s %-12.11s %s", name, type, help);
|
||||
UTIL_ConsolePrint(" %-17.16s %-12.11s %s", name, type, help);
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@ -336,7 +336,7 @@ native FormatActivitySource(client, target, const String:namebuf[], maxlength);
|
||||
typedef SrvCmd = function Action (int args);
|
||||
|
||||
/**
|
||||
* Creates a server-only console command, or hooks an already existing one.
|
||||
* Creates a server-only console command. Use AddCommandListener to hook an existing command.
|
||||
*
|
||||
* Server commands are case sensitive.
|
||||
*
|
||||
@ -360,11 +360,10 @@ native RegServerCmd(const String:cmd[], SrvCmd:callback, const String:descriptio
|
||||
typedef ConCmd = function Action (int client, int args);
|
||||
|
||||
/**
|
||||
* Creates a console command, or hooks an already existing one.
|
||||
* Creates a console command. Use AddCommandListener to hook existing commands.
|
||||
*
|
||||
* Console commands are case sensitive. However, if the command already exists in the game,
|
||||
* a client may enter the command in any case. SourceMod corrects for this automatically,
|
||||
* and you should only hook the "real" version of the command.
|
||||
* Console commands are case sensitive from both the client and server.
|
||||
* A chat trigger is automatically registered, without the "sm_" prefix if present.
|
||||
*
|
||||
* @param cmd Name of the command to hook or create.
|
||||
* @param callback A function to use as a callback for when the command is invoked.
|
||||
@ -376,11 +375,11 @@ typedef ConCmd = function Action (int client, int args);
|
||||
native RegConsoleCmd(const String:cmd[], ConCmd:callback, const String:description[]="", flags=0);
|
||||
|
||||
/**
|
||||
* Creates a console command as an administrative command. If the command does not exist,
|
||||
* it is created. When this command is invoked, the access rights of the player are
|
||||
* automatically checked before allowing it to continue.
|
||||
* Creates a console command as an administrative command. When this command is invoked,
|
||||
* the access rights of the player are automatically checked before allowing it to continue.
|
||||
*
|
||||
* Admin commands are case sensitive from both the client and server.
|
||||
* A chat trigger is automatically registered, without the "sm_" prefix if present.
|
||||
*
|
||||
* @param cmd String containing command to register.
|
||||
* @param callback A function to use as a callback for when the command is invoked.
|
||||
@ -652,7 +651,7 @@ stock bool:CommandExists(const String:command[])
|
||||
* @param sArgs Chat argument string.
|
||||
*
|
||||
* @return An Action value. Returning Plugin_Handled bypasses the game function call.
|
||||
Returning Plugin_Stop bypasses the post hook as well as the game function.
|
||||
* Returning Plugin_Stop bypasses the post hook as well as the game function.
|
||||
*/
|
||||
forward Action:OnClientSayCommand(client, const String:command[], const String:sArgs[]);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user