mIRC Homepage
Posted By: zad0909 Flood script - 02/10/07 02:18 AM
Looking for a script where if someone spams a command for my bot over and over (they all start with !) It will ignore the person for a set period of time.

I think I saw this script on here before maybe.

Anyway can someone show me or link me to one?

tHanks.
Posted By: RusselB Re: Flood script - 02/10/07 02:34 AM
You can modify your script to cover flooding options, or try searching sites like Hawkee or mIRC Scripts

If you did see the code on here, then try using the Search engine
Posted By: genius_at_work Re: Flood script - 02/10/07 02:42 AM
You can add a simple flood protection to any script. Just add these lines at the beginning of your text events:

Code:

if ($hget(flood,$+(n.,$nick)) > 5) return
hinc -mu30 flood $+(n.,$nick) 1



-genius_at_work
Posted By: zad0909 Re: Flood script - 02/10/07 03:25 AM
Tried all 3 sites really couldnt find one.

I have a lot of scripts already in the bot. Plus is that for if someone else is using the command? I want it to ignore them.

Any ideas on how to script this at all?
Posted By: genius_at_work Re: Flood script - 02/10/07 04:12 AM
The code I gave doesn't put the person on ignore. It simply prevents them from using any of the !commands. Just add the above code at the very top of each onTEXT event. It will keep track of each user individually, but will ignore a user from using ALL commands (where the code is included) if they flood.

-genius_at_work
Posted By: Garou Re: Flood script - 02/10/07 02:20 PM
genius_at_work this here will stop anyone from using any commands?

On *:TEXT:*:#: {
if ($hget(flood,$+(n.,$nick)) > 5) return
hinc -mu30 flood $+(n.,$nick) 1
}
Posted By: TropNul Re: Flood script - 02/10/07 04:31 PM
On *:TEXT:*:#:{
if ($hget(flood,$+(n.,$nick)) > 5) return
hinc -mu30 flood $+(n.,$nick) 1
}

No, this script will not stop anyone to send PRIVMSGs. It will only stop only those who sent, in 30 seconds time, atleast 5 PRIVMSGs. The client's behaviour will only be an 'ignore' to those people.
Posted By: zad0909 Re: Flood script - 02/10/07 06:42 PM
I have a lot of ontest commands. Is this the only way to do it?
IT could take a while to put it at the top of everyone single one.
Posted By: Lpfix5 Re: Flood script - 02/10/07 08:02 PM
Originally Posted By: zad0909
I have a lot of ontest commands. Is this the only way to do it?
IT could take a while to put it at the top of everyone single one.


Zad if you have alot of on text commands I suggest putting everything in one look how to do so ill show you

Code:
on *:TEXT:!hit*:#:{
describe hits $nick in the face
}

on *:TEXT:!slap*:#:{
describe slaps $nick across the face
}

on *:TEXT:!beer*:#:{
describe gives $nick a cold ice beer.
}


you can turn that into one on text event.

Code:
on *:TEXT:*:#:{
if ($1 == !hit) { describe hits $nick in the face }
elseif ($1 == !slap) { describe slaps $nick across the face }
elseif ($1 == !beer) { describe gives $nick a cold ice beer. }
}


Then you can add the code to that text event.
Posted By: DJ_Sol Re: Flood script - 03/10/07 03:21 AM
Im not sure if it was clear so I will do my best to make it clear.

To start with it doesn't add someone to the ignore list. That's not what he meant by "ignore".

Someone messages !start in the room.

You have an on text event to act on this message.

on *:text:!start:#:{
msg $chan It has started $nick
}

Now if I don't want them to flood my script out by typing !start a bunch of times I count how many times they say !start. Best way to do this is with the /inc command. (Genius showed you a method using inc in a hash table, /hinc. I will use a variable as it tends to be easier for beginners to grasp.)

/inc %flood. [ $+ [ $nick ] ]

The first time they say !start, this variable is set to 1 and named after them. The /inc command adds 1 everytime it is run.

Travis: !start
%flood.Travis == 1
Travis: !start
%flood.Travis == 2

But if someone says !start once, then an hour later they say !start we don't want it counted. What we do is set a timed variable which unsets itself after a number of seconds.

/inc -u5 %flood. [ $+ [ $nick ] ]

This unsets after 5 seconds.

Ok, so the last and most important step is recognizing a flood. Simply put, it adds 1 everytime they say !start. If they say !start 5 times before the variable gets unset, the variable == 5. So you say, if the variable is greater than or equal to 5, halt (or return).

if (%flood. [ $+ [ $nick ] ] >= 5) { return }

This is how you stop someone from flooding your text response. Now lets put it all together.

Quote:
on *:text:!start:#:{

if (%flood. [ $+ [ $nick ] ] >= 5) { return }

msg $chan Hi $nick $+ ! Game is now started!

inc -u5 %flood. [ $+ [ $nick ] ]

}
© mIRC Discussion Forums