/** * vim: set ts=4 : * =============================================================== * SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved. * =============================================================== * * This file is not open source and may not be copied without explicit * written permission of AlliedModders LLC. This file may not be redistributed * in whole or significant part. * For information, see LICENSE.txt or http://www.sourcemod.net/license.php * * Version: $Id$ */ #include "CoreConfig.h" #include "sourcemod.h" #include "sourcemm_api.h" #include "sm_srvcmds.h" #include "LibrarySys.h" #include "TextParsers.h" #include "Logger.h" #ifdef PLATFORM_WINDOWS ConVar sm_corecfgfile("sm_corecfgfile", "addons\\sourcemod\\configs\\core.cfg", 0, "SourceMod core configuration file"); #else ConVar sm_corecfgfile("sm_corecfgfile", "addons/sourcemod/configs/core.cfg", 0, "SourceMod core configuration file"); #endif CoreConfig g_CoreConfig; void CoreConfig::OnSourceModAllInitialized() { g_RootMenu.AddRootConsoleCommand("config", "Set core configuration options", this); } void CoreConfig::OnSourceModShutdown() { g_RootMenu.RemoveRootConsoleCommand("config", this); } void CoreConfig::OnRootConsoleCommand(const char *command, unsigned int argcount) { if (argcount >= 4) { const char *option = engine->Cmd_Argv(2); const char *value = engine->Cmd_Argv(3); CoreConfigErr err = SetConfigOption(option, value); switch (err) { case CoreConfig_NoRuntime: g_RootMenu.ConsolePrint("[SM] Cannot set \"%s\" while SourceMod is running.", option); break; case CoreConfig_InvalidValue: g_RootMenu.ConsolePrint("[SM] Invalid value \"%s\" specified for configuration option \"%s\"", value, option); break; case CoreConfig_InvalidOption: g_RootMenu.ConsolePrint("[SM] Invalid configuration option specified: %s", option); break; default: break; } return; } g_RootMenu.ConsolePrint("[SM] Usage: sm config