View Single Post
fjlep
Junior Member
Join Date: Apr 2024
Old 04-21-2024 , 18:12   Re: Execute cfg via chat
Reply With Quote #7

Quote:
Originally Posted by Bugsy View Post
Add your config files to the array, excluding the ".cfg" extension. Do you want to limit who can execute config files to admins only?

This will support saying /lo3 or .lo3
PHP Code:
#include <amxmodx>

new const Version[] = "0.1";

new const 
configs[][] = 
{
    
"lo3",
    
"lo4",
    
"lo5"
};

public 
plugin_init() 
{
    
register_plugin"Say Exec Config" Version "bugsy" );
    
    
register_clcmd"say" "SayHook" );
    
register_clcmd"say_team" "SayHook" ); 
}

public 
SayHook() 
{
    new 
szArg];
    
    
read_argvszArg charsmaxszArg ) );
    
    for ( new 
sizeofconfigs ) ; i++ )
    {
        if ( 
equalszArg] , configs] ) )
        {
            
server_cmd"exec %s.cfg" szArg );
            break;
        }
    }

When I type .lo3 in chat in console I get this "couldn't exec .lo3.cfg" I have the files in /cstrike/, if I type /lo3 I get this exec /lo3.cfg: invalid path and I would like admin's only to be able to use this option.

Last edited by fjlep; 04-21-2024 at 18:35.
fjlep is offline