mIRC Home    About    Download    Register    News    Help

Print Thread
#187245 02/10/07 02:18 AM
Joined: Jul 2007
Posts: 42
Z
zad0909 Offline OP
Ameglian cow
OP Offline
Ameglian cow
Z
Joined: Jul 2007
Posts: 42
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.

zad0909 #187246 02/10/07 02:34 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
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

zad0909 #187247 02/10/07 02:42 AM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
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

Joined: Jul 2007
Posts: 42
Z
zad0909 Offline OP
Ameglian cow
OP Offline
Ameglian cow
Z
Joined: Jul 2007
Posts: 42
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?

zad0909 #187252 02/10/07 04:12 AM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
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

Joined: Aug 2006
Posts: 469
G
Fjord artisan
Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
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
}

Garou #187275 02/10/07 04:31 PM
Joined: May 2007
Posts: 89
T
Babel fish
Offline
Babel fish
T
Joined: May 2007
Posts: 89
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.


tropnul
TropNul #187282 02/10/07 06:42 PM
Joined: Jul 2007
Posts: 42
Z
zad0909 Offline OP
Ameglian cow
OP Offline
Ameglian cow
Z
Joined: Jul 2007
Posts: 42
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.

zad0909 #187284 02/10/07 08:02 PM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
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.


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Lpfix5 #187299 03/10/07 03:21 AM
Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
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 ] ]

}


Link Copied to Clipboard