Release Anti Flood plugin
#1
This plugins basicly protects your server from spammers.

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:
Code:
using System; using System.Collections.Generic; using System.Threading; using Addon; namespace Anti_Flood { public class Anti_Flood : CPlugin { List<AntiFlood> Floodlist = new List<AntiFlood>(); 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 ) new Thread( new ParameterizedThreadStart( PunishThread ) ).Start( Client ); else player.Warnings++; return ChatType.ChatNone; } } Floodlist.Add( new AntiFlood( Client, Time, MaxWarnings ) ); 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:

.rar   mw3-anti-flood.rar (Size: 2.9 KB / Downloads: 207)

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

Reply

#2
(01-08-2012, 21:07)iAegle Wrote: I didn't test it, but if something doesn't work properly please post the problem here.

Code:
return ChatType.ChatAll;

should be (unless you want to break all other plugins):

Code:
return ChatType.ChatContinue;


Still, nice work
[Image: b_560_95_1.png]
Reply

#3
(01-08-2012, 21:09)Nukem Wrote:
(01-08-2012, 21:07)iAegle Wrote: I didn't test it, but if something doesn't work properly please post the problem here.

Code:
return ChatType.ChatAll;

should be (unless you want to break all other plugins):

Code:
return ChatType.ChatContinue;


Still, nice work

Why did you even include ChatType.ChatNone if you tell everyone to use ChatContinue :p?
(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

Reply

#4
Why do you never test your plugins
[Image: MaEIQ.png]
Reply

#5
(01-08-2012, 21:12)Pozzuh Wrote: Why do you never test your plugins

Ohh thats simple, because I can't :p
(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

Reply

#6
(01-08-2012, 21:12)iAegle Wrote:
(01-08-2012, 21:12)Pozzuh Wrote: Why do you never test your plugins

Ohh thats simple, because I can't :p

why cant you
[Image: MaEIQ.png]
Reply

#7
lol @ 6 reactions and 0 downloads Troll
Reply

#8
(01-08-2012, 21:17)Pozzuh Wrote:
(01-08-2012, 21:12)iAegle Wrote:
(01-08-2012, 21:12)Pozzuh Wrote: Why do you never test your plugins

Ohh thats simple, because I can't :p

why cant you

No game/server
(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

Reply

#9
(01-08-2012, 21:27)iAegle Wrote:
(01-08-2012, 21:17)Pozzuh Wrote:
(01-08-2012, 21:12)iAegle Wrote:
(01-08-2012, 21:12)Pozzuh Wrote: Why do you never test your plugins

Ohh thats simple, because I can't :p

why cant you

No game/server

Why don't you install it
[Image: MaEIQ.png]
Reply

#10
This anti flood thingy was always pissing me off, but still nice work.
This anti flood thingy was always pissing me off, but still nice work.
[Image: lQDUjba.jpg]
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
Wink Plugin with !ban !kick and !tampban clemi555 3 6,492 11-09-2013, 09:21
Last Post: clemi555
  AntiNoScope Plugin clemi555 5 7,592 11-08-2013, 19:13
Last Post: clemi555
  [Release] iSnipe anti hardscope mutant 0 4,787 11-06-2013, 11:27
Last Post: mutant
  [Release] Bunker Plugin 1.3 archit 68 55,806 10-30-2013, 11:59
Last Post: clacki
  Help Modifying plugin maverigh 5 7,643 10-19-2013, 10:29
Last Post: Nekochan
Shocked [Request] Switch plugin axel-le-meilleur 6 8,295 10-19-2013, 06:59
Last Post: iRoNinja
  Need An Anti Hack Manuadminmod worldclass 2 4,812 10-14-2013, 09:57
Last Post: d0h!
  [Release] Yurio Map Plugin Yurio 101 82,121 09-26-2013, 13:38
Last Post: First_Semyon
Brick [Release] v1.1 ChangeMap/NextMap Plugin without any configuration milchshake 23 25,160 09-23-2013, 13:18
Last Post: SgtLegend
  Help !say Plugin (like the !say from GodPlugin) Hallla 0 3,655 09-13-2013, 09:31
Last Post: Hallla

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2026 Melroy van den Berg.