diff --git a/plugins/basecommands.sp b/plugins/basecommands.sp index 32b8625e..8ff82d3c 100644 --- a/plugins/basecommands.sp +++ b/plugins/basecommands.sp @@ -41,6 +41,34 @@ public OnPluginStart() RegAdminCmd("sm_map", Command_Map, ADMFLAG_CHANGEMAP, "sm_map "); RegAdminCmd("sm_rcon", Command_Rcon, ADMFLAG_RCON, "sm_rcon "); RegAdminCmd("sm_cvar", Command_Cvar, ADMFLAG_CONVARS, "sm_cvar [value]"); + RegAdminCmd("sm_execcfg", Command_ExecCfg, ADMFLAG_CONFIG, "sm_execcfg "); +} + +public Action:Command_ExecCfg(client, args) +{ + if (args < 1) + { + ReplyToCommand(client, "[SM] Usage: sm_execcfg "); + return Plugin_Handled; + } + + new String:path[64] = "cfg/"; + GetCmdArg(1, path[4], sizeof(path)-4); + + if (!FileExists(path)) + { + ReplyToCommand(client, "[SM] %t", "Config not found", path[4]); + return Plugin_Handled; + } + + LogMessage("\"%L\" executed config (file \"%s\")", client, path[4]); + ShowActivity(client, "%t", "Executed config", path[4]); + + ServerCommand("exec \"%s\"", path[4]); + + ReplyToCommand(client, "[SM] %t", "Executed config", path[4]); + + return Plugin_Handled; } public Action:Command_Cvar(client, args) diff --git a/translations/plugin.basecommands.cfg b/translations/plugin.basecommands.cfg index 0c6b88fb..3771a295 100644 --- a/translations/plugin.basecommands.cfg +++ b/translations/plugin.basecommands.cfg @@ -22,4 +22,16 @@ "#format" "{1:s},{2:s}" "en" "Changed cvar '{1}' to '{2}'." } + + "Config not found" + { + "#format" "{1:s}" + "en" "Config file '{1}' not found." + } + + "Executed config" + { + "#format" "{1:s}" + "en" "Executed config '{1}'." + } }