HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1.  
  2. #include <amxmodx>
  3. #include <orpheu>
  4.  
  5. new OrpheuFunction:HandleFuncNETQueuePacket;
  6. new OrpheuFunction:HandleFuncConPrintf;
  7.  
  8. new OrpheuHook:HandleHookConPrintf;
  9.  
  10. public plugin_init()
  11. {
  12. register_plugin( "Ban NET Packet Spammer", "1.0.2", "Arkshine" );
  13.  
  14. HandleFuncNETQueuePacket = OrpheuGetFunction( "NET_QueuePacket" );
  15. HandleFuncConPrintf = OrpheuGetFunction( "Con_Printf" );
  16.  
  17. OrpheuRegisterHook( HandleFuncNETQueuePacket, "NET_QueuePacket_Pre", OrpheuHookPre );
  18. OrpheuRegisterHook( HandleFuncNETQueuePacket, "NET_QueuePacket_Post", OrpheuHookPost );
  19. }
  20.  
  21. public NET_QueuePacket_Pre()
  22. {
  23. HandleHookConPrintf = OrpheuRegisterHook( HandleFuncConPrintf, "Con_Printf" );
  24. }
  25.  
  26. public Con_Printf( const fmt[], const arg[] )
  27. {
  28. static const message[] = "Oversize packet from";
  29.  
  30. if( contain( fmt, message ) > 0 )
  31. {
  32. new ip[ 16 ];
  33. copyc( ip, charsmax( ip ), arg, ':' );
  34.  
  35. log_to_file( "NET_Packet_Spammer.log", "Blokkolva %s", ip );
  36. server_cmd( "addip 0 ^"%s^"", ip );
  37. server_exec();
  38. }
  39. }
  40.  
  41. public NET_QueuePacket_Post()
  42. {
  43. OrpheuUnregisterHook( HandleHookConPrintf );
  44. }