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
Rainbow [Release] Plugin ReservedSlot v1.3 frst_ 1 4,996 11-08-2018, 19:17
Last Post: frst_
Tongue [Release] MW3 Shop plugin Dude 56 51,301 03-25-2018, 05:18
Last Post: [email protected]
Wink [Release] Anti hardscope script mutant 6 9,457 06-10-2017, 09:31
Last Post: Erox
  [Release] Permission plugin Pozzuh 202 163,920 05-01-2017, 15:41
Last Post: W4R||The Hyper
  [Release] FIXED SPEED PLUGIN hillbilly 2 5,656 06-02-2016, 20:23
Last Post: clacki
  [Release] Bots Plugin For Users Casper 22 39,849 08-22-2015, 17:45
Last Post: SnapBacks
  [Release] God Plugin v5.0 [Ingame Rcon Tool] OzonE 464 335,775 06-27-2015, 15:38
Last Post: bluedot
  [Release] Anti Hardscope Plugin 8q4s8 26 27,593 06-20-2015, 22:44
Last Post: urj88419
  [Release] ProMod Plugin zxz0O0 875 761,608 03-25-2015, 22:02
Last Post: kris
  [Release] [Discontinued] Speed Plugin Pozzuh 164 121,944 10-06-2014, 12:56
Last Post: Nekochan

Forum Jump:


Users browsing this thread:
1 Guest(s)

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