added admin access checking
added syncing between overrides (note: denial message is a todo) --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40520
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
#include "HandleSys.h"
|
||||
#include "CConVarManager.h"
|
||||
#include "CConCmdManager.h"
|
||||
#include "PluginSys.h"
|
||||
|
||||
static cell_t sm_CreateConVar(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
@@ -361,6 +362,35 @@ static cell_t sm_RegConsoleCmd(IPluginContext *pContext, const cell_t *params)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell_t sm_RegAdminCmd(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
char *name,*help;
|
||||
const char *group;
|
||||
IPluginFunction *pFunction;
|
||||
FlagBits flags = params[3];
|
||||
int cmdflags = params[6];
|
||||
|
||||
pContext->LocalToString(params[1], &name);
|
||||
pContext->LocalToString(params[4], &help);
|
||||
pContext->LocalToString(params[5], (char **)&group);
|
||||
pFunction = pContext->GetFunctionById(params[2]);
|
||||
|
||||
if (group[0] == '\0')
|
||||
{
|
||||
CPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pContext->GetContext());
|
||||
group = pPlugin->GetFilename();
|
||||
}
|
||||
|
||||
if (!pFunction)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid function id (%X)", params[2]);
|
||||
}
|
||||
|
||||
g_ConCmds.AddAdminCommand(pFunction, name, group, flags, help, cmdflags);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
REGISTER_NATIVES(convarNatives)
|
||||
{
|
||||
{"CreateConVar", sm_CreateConVar},
|
||||
|
||||
Reference in New Issue
Block a user