01-08-2012, 21:07
This plugins basicly protects your server from spammers.
You can change some settings in the sv_config.ini:
Source:
Plugin:
mw3-anti-flood.rar (Size: 2.9 KB / Downloads: 175)
I didn't test it, but if something doesn't work properly please post the problem here.
You can change some settings in the sv_config.ini:
Code:
[ANTIFLOOD]
warnings=3 //how much warnings will a player get
time=2 //the time in seconds that a player has to wait untill he can chat again
punish=true //true will kick the player after he has ignored his warnings, false will only hide the message
Source:
CSHARP Code
- using System;
- using System.Collections.Generic;
- using System.Threading;
- using Addon;
-
- namespace Anti_Flood
- {
- public class Anti_Flood : CPlugin
- {
- int MaxWarnings;
- int Time;
- bool Punish;
-
- public override void OnServerLoad()
- {
- ServerPrint( "Anti-Flood plugin. Author: iAegle. Version: 1.0" );
- Time = Convert.ToInt32( Convert.ToDecimal( GetServerCFG( "ANTIFLOOD", "time", "2" ) ) * 50 );
- MaxWarnings = Convert.ToInt32( GetServerCFG( "ANTIFLOOD", "warnings", "3" ) );
- Punish = ( GetServerCFG( "ANTIFLOOD", "punish", "true" ) == "true" );
- }
-
- public override void OnServerFrame()
- {
- foreach ( AntiFlood player in Floodlist )
- {
- player.Waittime--;
-
- if ( player.Waittime == 0 )
- Floodlist.Remove( player );
- }
- }
-
- public override ChatType OnSay( string Message, ServerClient Client )
- {
- foreach ( AntiFlood player in Floodlist )
- {
- if ( player.Client == Client )
- {
- if ( !Punish )
- return ChatType.ChatNone;
-
- iPrintLnBold( ( player.Warnings <= 2 ) ? "Stop spamming! [^1Warnings Left" + ( 2 - player.Warnings ).ToString() + "^7]" : "^1You better pay attention the the warnings next time.", Client );
- if ( player.Warnings >= 3 )
- else
- player.Warnings++;
-
- return ChatType.ChatNone;
- }
- }
-
- return ChatType.ChatAll;
- }
-
- public void PunishThread( object Client )
- {
- ServerClient client = ( ServerClient )Client;
- Thread.Sleep( 2500 );
- iPrintLnBold( "Bye bye spammer. :)", client );
- Thread.Sleep( 1000 );
- ServerCommand( "kickclient " + client.ClientNum );
- iPrintLn( client.Name + " got kicked for spamming.", null );
- }
-
- public class AntiFlood
- {
- public int Waittime;
- public ServerClient Client;
- public int Warnings;
- public AntiFlood( ServerClient client, int time, int warnings )
- {
- Client = client;
- Waittime = time;
- Warnings = warnings;
- }
- }
- }
- }
Plugin:
mw3-anti-flood.rar (Size: 2.9 KB / Downloads: 175)
I didn't test it, but if something doesn't work properly please post the problem here.
(08-10-2011, 12:58)Pozzuh Wrote:Se7en Wrote:Stealed, from cod4 mod ...look who's talking
[Release] Old School Mod v2.2
[Release] Scroll menu