Here i have the autobuy bug fixer, is there a way to improve it by telling everybody in the server with a large coloured message when someone is trying to crash the server by using this bug?
I'm sure if something like this happens, lammers won't try it again...
PHP Code:
#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 plugin_cfg()
{
if(is_plugin_loaded("Pause Plugins") > -1)
server_cmd("amx_pausecfg add ^"Fix AutoBuy Bug^"");
}
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, "AutoBuyBug used by: %s [%s] [%s]", name, ip, steamid )
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang3082\\ f0\\ fs16 \n\\ par }
*/