Page 1 of 1

Plugin autobuy_fix

Posted: 28 Jul 2012, 17:51
by smileye
Vreau sa imi modificati sma-ul sa aiba cvar-urile:

0 - Dezactivata protectia
1 - Kick
2 - Ban x min pe IP ( setati 30min)
3 - TIMEOUT
| Afiseaza codul
#include <amxmodx> 

#define PLUGIN_NAME       "Fix AutoBuy Bug" 
#define PLUGIN_VERSION    "1.1" 
#define PLUGIN_AUTHOR     "PomanoB / UFPS.Team"

new g_logfile[64] 

public plugin_init( ) 
{ 
    register_plugin( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR ) 

    register_clcmd( "cl_setautobuy", "cmd_check" ) 
    register_clcmd( "cl_setrebuy", "cmd_check" ) 

    get_time ( "autobuy_%Y%m.log", g_logfile, charsmax ( g_logfile ) ) 
} 

public cmd_check( id ) 
{ 
    static arg[512], args, i 
    args = read_argc( ) 

    for( i = 1; i < args; ++i ) 
    { 
        read_argv( i, arg, charsmax( arg ) ) 

        if( is_cmd_long( arg, charsmax( arg ) ) ) 
        { 
            log_autobuy( id ) 
            return PLUGIN_HANDLED 
        } 
    } 

    return PLUGIN_CONTINUE 
} 

stock bool:is_cmd_long( string[], const len ) 
{ 
    static cmd[512] 

    while( strlen( string ) ) 
    { 
        strtok( string, cmd, charsmax( cmd ), string, len , ' ', 1 ) 

        if( strlen( cmd ) > 31 ) return true 
    } 

    return false 
} 

stock log_autobuy( id ) 
{ 
    static name[32], steamid[44], ip[16] 
    get_user_ip( id, ip, charsmax( ip ), 1 ) 
    get_user_authid( id, steamid, charsmax( steamid ) ) 
    get_user_name( id, name, charsmax( name ) ) 

    log_to_file( g_logfile, "Autobuy bug use: %s [%s] <%s>", name, ip, steamid ) 
}