Commands with the same name as an existing convar can no longer be created

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40585
This commit is contained in:
Scott Ehlert
2007-03-06 06:15:19 +00:00
parent ac9051ab71
commit 70ec3db66c
5 changed files with 84 additions and 47 deletions
+13 -4
View File
@@ -15,7 +15,7 @@
#include "sourcemm_api.h"
#include "HandleSys.h"
#include "CConVarManager.h"
#include "CConCmdManager.h"
#include "ConCmdManager.h"
#include "PluginSys.h"
#include "sm_stringutil.h"
#include "CPlayerManager.h"
@@ -340,7 +340,10 @@ static cell_t sm_RegServerCmd(IPluginContext *pContext, const cell_t *params)
return pContext->ThrowNativeError("Invalid function id (%X)", params[2]);
}
g_ConCmds.AddServerCommand(pFunction, name, help, params[4]);
if (!g_ConCmds.AddServerCommand(pFunction, name, help, params[4]))
{
return pContext->ThrowNativeError("Command \"%s\" could not be created. A convar with the same name already exists.", name);
}
return 1;
}
@@ -359,7 +362,10 @@ static cell_t sm_RegConsoleCmd(IPluginContext *pContext, const cell_t *params)
return pContext->ThrowNativeError("Invalid function id (%X)", params[2]);
}
g_ConCmds.AddConsoleCommand(pFunction, name, help, params[4]);
if (!g_ConCmds.AddConsoleCommand(pFunction, name, help, params[4]))
{
return pContext->ThrowNativeError("Command \"%s\" could not be created. A convar with the same name already exists.", name);
}
return 1;
}
@@ -388,7 +394,10 @@ static cell_t sm_RegAdminCmd(IPluginContext *pContext, const cell_t *params)
return pContext->ThrowNativeError("Invalid function id (%X)", params[2]);
}
g_ConCmds.AddAdminCommand(pFunction, name, group, flags, help, cmdflags);
if (!g_ConCmds.AddAdminCommand(pFunction, name, group, flags, help, cmdflags))
{
return pContext->ThrowNativeError("Command \"%s\" could not be created. A convar with the same name already exists.", name);
}
return 1;
}