This plugin crashing my server:
https://forums.alliedmods.net/showpo...04&postcount=4
Crashes after a few hours of being active.. What should I do? I need NET_QueuePacket Anti Spam
PHP Code:
#include <amxmodx>
#include <orpheu>
new OrpheuFunction:HandleFuncNETQueuePacket;
new OrpheuFunction:HandleFuncConPrintf;
new OrpheuHook:HandleHookConPrintf;
public plugin_init()
{
register_plugin( "Ban NET Packet Spammer", "1.0.1", "Arkshine" );
HandleFuncNETQueuePacket = OrpheuGetFunction( "NET_QueuePacket" );
HandleFuncConPrintf = OrpheuGetFunction( "Con_Printf" );
OrpheuRegisterHook( HandleFuncNETQueuePacket, "NET_QueuePacket_Pre", OrpheuHookPre );
OrpheuRegisterHook( HandleFuncNETQueuePacket, "NET_QueuePacket_Post", OrpheuHookPost );
}
public NET_QueuePacket_Pre()
{
HandleHookConPrintf = OrpheuRegisterHook( HandleFuncConPrintf, "Con_Printf" );
}
public Con_Printf( const fmt[], const arg[] )
{
static const message[] = "Oversize packet from ";
if( contain( fmt, message ) >= 0 )
{
new ip[ 16 ], i, c;
while( i < charsmax( ip ) && ( c = fmt[ i + charsmax( message ) ] ) && c != ':' )
{
ip[ i++ ] = c;
}
ip[ i ] = EOS;
log_to_file( "NET_Packet_Spammer.log", "Blocking %s", ip );
server_cmd( "addip 0 ^"%s^"", ip );
server_exec();
}
}
public NET_QueuePacket_Post()
{
OrpheuUnregisterHook( HandleHookConPrintf );
__________________