#include /* flood.pwn * ---------------------------- * This filterscript enables flood protection for your server. * A player is allowed to say 8 lines in 6 seconds, which is * quite alot, but not yet considered spam. * * Version: $Id: flood.pwn,v 1.00 2006/12/19 19:27:00 Peter Exp $ * */ new PlayerFlood[ MAX_PLAYERS ]; main() { print("\n----------------------------------"); print(" Anti-flood filterscript loaded"); print("----------------------------------\n"); } public OnFilterScriptInit( ) { /* Set the timer which is used to clear the player's number of lines, after 6 seconds. */ SetTimer( "ClearPlayerFlood", 6000, 1 ); } public OnPlayerText( playerid ) { PlayerFlood[ playerid ]++; if( PlayerFlood[ playerid ] >= 6 ) { /* Apperently this player is flooding. We kick him */ SendClientMessage( playerid, 0x0000FFFF, "You have been kicked for flooding." ); SetTimerEx( "KickPlayer", 750, 0, "i", playerid ); } return 1; } public KickPlayer( playerid ) { Kick( playerid ); } public ClearPlayerFlood( ) { for( new i = 0; i < MAX_PLAYERS; i ++ ) { PlayerFlood[ i ] = 0; } }