/** * 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"); #elif defined PLATFORM_LINUX 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); char error[255]; ConfigResult res = SetConfigOption(option, value, ConfigSource_Console, error, sizeof(error)); if (res == ConfigResult_Reject) { g_RootMenu.ConsolePrint("[SM] Could not set config option \"%s\" to \"%s\" (%s)", option, value, error); } else if (res == ConfigResult_Ignore) { g_RootMenu.ConsolePrint("[SM] No such config option \"%s\" exists.", option); } else { g_RootMenu.ConsolePrint("Config option \"%s\" successfully set to \"%s.\"", option, value); } return; } g_RootMenu.ConsolePrint("[SM] Usage: sm config