plugins/basecommands.sp
changeset 921 e07dad9724f5
parent 920 d66cf93ef5e3
child 922 980941c525fa
     1.1 --- a/plugins/basecommands.sp	Thu Jun 07 23:48:51 2007 +0000
     1.2 +++ b/plugins/basecommands.sp	Fri Jun 08 01:01:44 2007 +0000
     1.3 @@ -41,6 +41,34 @@
     1.4  	RegAdminCmd("sm_map", Command_Map, ADMFLAG_CHANGEMAP, "sm_map <map>");
     1.5  	RegAdminCmd("sm_rcon", Command_Rcon, ADMFLAG_RCON, "sm_rcon <args>");
     1.6  	RegAdminCmd("sm_cvar", Command_Cvar, ADMFLAG_CONVARS, "sm_cvar <cvar> [value]");
     1.7 +	RegAdminCmd("sm_execcfg", Command_ExecCfg, ADMFLAG_CONFIG, "sm_execcfg <filename>");
     1.8 +}
     1.9 +
    1.10 +public Action:Command_ExecCfg(client, args)
    1.11 +{
    1.12 +	if (args < 1)
    1.13 +	{
    1.14 +		ReplyToCommand(client, "[SM] Usage: sm_execcfg <filename>");
    1.15 +		return Plugin_Handled;
    1.16 +	}
    1.17 +	
    1.18 +	new String:path[64] = "cfg/";
    1.19 +	GetCmdArg(1, path[4], sizeof(path)-4);
    1.20 +	
    1.21 +	if (!FileExists(path))
    1.22 +	{
    1.23 +		ReplyToCommand(client, "[SM] %t", "Config not found", path[4]);
    1.24 +		return Plugin_Handled;
    1.25 +	}
    1.26 +	
    1.27 +	LogMessage("\"%L\" executed config (file \"%s\")", client, path[4]);
    1.28 +	ShowActivity(client, "%t", "Executed config", path[4]);
    1.29 +		
    1.30 +	ServerCommand("exec \"%s\"", path[4]);
    1.31 +	
    1.32 +	ReplyToCommand(client, "[SM] %t", "Executed config", path[4]);
    1.33 +	
    1.34 +	return Plugin_Handled;
    1.35  }
    1.36  
    1.37  public Action:Command_Cvar(client, args)