1.1 --- a/core/smn_console.cpp Tue Mar 06 04:53:14 2007 +0000
1.2 +++ b/core/smn_console.cpp Tue Mar 06 06:15:19 2007 +0000
1.3 @@ -15,7 +15,7 @@
1.4 #include "sourcemm_api.h"
1.5 #include "HandleSys.h"
1.6 #include "CConVarManager.h"
1.7 -#include "CConCmdManager.h"
1.8 +#include "ConCmdManager.h"
1.9 #include "PluginSys.h"
1.10 #include "sm_stringutil.h"
1.11 #include "CPlayerManager.h"
1.12 @@ -340,7 +340,10 @@
1.13 return pContext->ThrowNativeError("Invalid function id (%X)", params[2]);
1.14 }
1.15
1.16 - g_ConCmds.AddServerCommand(pFunction, name, help, params[4]);
1.17 + if (!g_ConCmds.AddServerCommand(pFunction, name, help, params[4]))
1.18 + {
1.19 + return pContext->ThrowNativeError("Command \"%s\" could not be created. A convar with the same name already exists.", name);
1.20 + }
1.21
1.22 return 1;
1.23 }
1.24 @@ -359,7 +362,10 @@
1.25 return pContext->ThrowNativeError("Invalid function id (%X)", params[2]);
1.26 }
1.27
1.28 - g_ConCmds.AddConsoleCommand(pFunction, name, help, params[4]);
1.29 + if (!g_ConCmds.AddConsoleCommand(pFunction, name, help, params[4]))
1.30 + {
1.31 + return pContext->ThrowNativeError("Command \"%s\" could not be created. A convar with the same name already exists.", name);
1.32 + }
1.33
1.34 return 1;
1.35 }
1.36 @@ -388,7 +394,10 @@
1.37 return pContext->ThrowNativeError("Invalid function id (%X)", params[2]);
1.38 }
1.39
1.40 - g_ConCmds.AddAdminCommand(pFunction, name, group, flags, help, cmdflags);
1.41 + if (!g_ConCmds.AddAdminCommand(pFunction, name, group, flags, help, cmdflags))
1.42 + {
1.43 + return pContext->ThrowNativeError("Command \"%s\" could not be created. A convar with the same name already exists.", name);
1.44 + }
1.45
1.46 return 1;
1.47 }