added sm_execcfg

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40927
This commit is contained in:
David Anderson 2007-06-08 01:01:44 +00:00
parent 3a02db6a1e
commit ce9b783485
2 changed files with 40 additions and 0 deletions

View File

@ -41,6 +41,34 @@ public OnPluginStart()
RegAdminCmd("sm_map", Command_Map, ADMFLAG_CHANGEMAP, "sm_map <map>");
RegAdminCmd("sm_rcon", Command_Rcon, ADMFLAG_RCON, "sm_rcon <args>");
RegAdminCmd("sm_cvar", Command_Cvar, ADMFLAG_CONVARS, "sm_cvar <cvar> [value]");
RegAdminCmd("sm_execcfg", Command_ExecCfg, ADMFLAG_CONFIG, "sm_execcfg <filename>");
}
public Action:Command_ExecCfg(client, args)
{
if (args < 1)
{
ReplyToCommand(client, "[SM] Usage: sm_execcfg <filename>");
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)

View File

@ -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}'."
}
}