View Single Post
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 05-23-2011 , 06:23   Re: Cvar Utilities
Reply With Quote #21

a mini question.
is it right so or can i do it better?

PHP Code:
new Catch_Enable

new Catchcvar CvarRegister"amx_catch_enable""1" )
    
CvarHookChangeCatchcvar,"Catch_Cvar" )

public 
Catch_Cvar( const handleCvar, const oldValue[], const newValue[], const cvarName[] )
{
    
catch_toggleForward( .enable newValue] == '1' );
}
public 
catch_toggleForward(const bool:enable )
{
    if(!
enable)
    {
        
client_print(0,print_chat,"Catchmod is now OFF")
        
Catch_Enable 0
    
}
    else
    {
        
client_print(0,print_chat,"Catchmod is now ON")
        
Catch_Enable 1
    
}
    
server_cmd("sv_restart 1")

PHP Code:
public Say_Command(id)
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    static 
say_args[64]
    
read_args(say_argscharsmax(say_args))
    
remove_quotes(say_args)
    
    if(
say_args[0] != '/')
    {
        return 
PLUGIN_CONTINUE
    
}
    if(
equali(say_args"/install") || equali(say_args"/installdb"))
    {
        if(
get_user_flags(id) & ADMIN_KICK)
        {
            
install_db(id)
        }
        else
        {
            
ChatColor(id"%L"LANG_PLAYER,"ERROR_NOT_ALLOWDED"PLUGIN)
        }
    }
    return 
PLUGIN_CONTINUE

do i have to user get_cvar_num or is it ok so? ( both works )
__________________

Last edited by One; 05-23-2011 at 06:31.
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One