Typos !Trigger Protection

By Typo on Jul 07, 2008

Typos !Trigger Protection is a unique snippet that can be used to protect all of your !Triggers with very little editing to your existing !trigger code.

What it does:
My script works in two ways, it protects the trigger from every individual user by tracking how often they used it in 'x' amount of seconds and making sure that if they do use it more than 'x' times in the set amount of time, that they are blocked for 'x' amount of seconds.

The script has a second protection scheme as well that protects the trigger from overuse by multiple nicknames by limiting the use of the trigger by all users.

Say for instance someone is upset and wants to flood you off. They notice you have flood protection on the triggers so they decide to be sneaky, instead of doing the trigger 100 times with one nickname, they connect 25 nicknames and do it 4 times with each. The answer to this is to protect the trigger itself against floods. This is accomplished by making it so that the trigger is only usable once every 'x' amount of seconds.

This begs the question why not only use the second method and the answer to this is that we need the system to be flexible. I want to make sure the trigger is only used once every 3 seconds period but I also want to make sure that each individual only uses it once every 10 seconds.

I have also incorporated a warning system that lets them know they are being blocked two times before fully ignoring them.

How it works:
When someone activates a !trigger it sets two variables, one is host specific to the user and blocks the user from using that trigger again for ten seconds and the other protects the !trigger from being hammered by multiple users, it makes it so the trigger can only be used once every 3 seconds, this is so a bunch of connections couldn't be used to bypass the flood protection with unique hosts calling the !trigger.

For instance if someone named somenick with the host of User@Host.net types !Example:
"%Triggerpro.!Example.User@Host.net" is increased by "1" (if it doesnt exist it is set to "1")
and
"%Trigger.!Example" is set to "yes".
Using those variables the script determines if the trigger is usable and by who.

To use it you incorporate it into the on text event for the !trigger.

Here is two examples of usage:
With:

on *:text:*:#testing1234:{ if ($1 == !trigger) { commands } }

you would use:

on *:text:*:#testing1234:{ if ($1 == !Trigger) && ($TriggerPro($nick,$v2) == $true) { commands } }

And with:

on *:text:!Trigger:#testing1234:{ commands }

you would use:

on *:text:!Trigger:#testing1234:{ if ($TriggerPro($nick,!Trigger)) { commands } }

Notice how one uses "If ($TriggerPro($nick,$v2) == $true)" and the other uses "If ($TriggerPro($nick,$v2))", these are the same exact thing in the mirc scripting language.

The $TriggerPro() handles the rest by doing nothing at all or by stopping the trigger from functioning and messaging the user about the flood protection being activated.

Example of the Trigger protection in action.

¤Jul07¤08:18PM¤ {-%TyposBot-} !topten
-Jul07-08:18PM- Top Ten list was displayed for the next ten lines but I pulled them.
¤Jul07¤08:18PM¤ {-%TyposBot-} !topten
-Jul07-08:18PM- Sorry, flood protection is preventing !TopTen from triggering. Try again in about 10 seconds.
¤Jul07¤08:18PM¤ {-%TyposBot-} !topten
-Jul07-08:18PM- Sorry, flood protection is preventing !TopTen from triggering. Try again in about 10 seconds. Last warning. Any other attempts at triggering !TopTen will be ignored until you wait for atleast a 10 second period.
¤Jul07¤08:18PM¤ {-%TyposBot-} !topten
¤Jul07¤08:18PM¤ {-%TyposBot-} !topten

alias triggerpro {
  if (%triggerpro. [ $+ [ $2 ] $+  . $+ [ $address($1,4) ] $+ . $+ [ $cid ] ] >= 1) || (%trigger. [ $+ [ $2 ] ]) { 
    $iif($v1 isnum 1-2,msg $chan Sorry $+ $chr(44) flood protection is preventing $2 from triggering.  Try again in about 10 seconds. $iif($v1 == 2,Last warning.  Any other attempts at triggering $2 will be ignored until you wait for atleast a 10 second period.))
    inc -u10 %triggerpro. $+ $2 $+ . $+ $address($1,4) $+ . $+ $cid
    return $false
  }
  inc -u10 %triggerpro. $+ $2 $+ . $+ $address($1,4) $+ . $+ $cid
  set -u3 %trigger. $+ $2 $ $+ true
  return $true
}

Comments

Sign in to comment.
bugboy1028   -  Feb 08, 2010

I argee! I am confused!

 Respond  
Pangaea   -  Dec 25, 2009

Heyas

Ok ive read the info about 10 times now, and tryed about 20 diffent things trying to get this to work.

I havent a clue what to do here at all. ive added the code into remotes.. but as far as all the other code u have posted i dont know. where dose this go??

I refare to this code:
on :text::#testing1234:{ if ($1 == !trigger) { commands } }
on :text::#testing1234:{ if ($1 == !Trigger) && ($TriggerPro($nick,$v2) == $true) { commands } }

on :text:!Trigger:#testing1234:{ commands }
on
:text:!Trigger:#testing1234:{ if ($TriggerPro($nick,!Trigger)) { commands } }

I understand that for !triggers i must put: { if ($TriggerPro($nick,!Trigger))
or do i? with or without the 2nd bracket?
and why is there another } now at the end?
and ive still not idea where the line goes

for example
on :TEXT:!calc :#: msg $chan $nick $+ : The answer is $calc($2-)

what do i have to put in there, and where?? with what bracket? and without?
i assume this:
on :TEXT:!calc :#:{ if ($TriggerPro($nick,!Trigger)) msg $chan $nick $+ : The answer is $calc($2-)}}
so that dosent work, nor dose it work anwhere i paste the line, take out or put back brackets.. dosent work.

The thing is, the example you gave is very specific.. every script i have is totaly differnt looking, and i havent a clue where to put that line, am i even ment to put the line in? and what about the first 2 codes? what are they?

I will paste a few sections of differnt scripts so u can get a feel of what i mean.
1.
on :TEXT:!seen:#:{
if (!$2) { halt }
else {
.....etc

2.
on *:TEXT:!meditate:#:{
set %fish $rand(1,100000000000000)
....etc

3.
on :TEXT:!birthday :#:{ If ($read(birthday.txt,s,$2)) { msg # $2 was born on $ifmatch } | else { msg # No Birthday details for $2 } }
on *:text:!today:#:{
var %a = 1, %b = $lines(birthday.txt), %today
...etc

there are 3 examples.. what line do i past in them, where, and what brackets go where.

If i get 3 examples here, i can use them for reference and work the rest out myself.

Would be great if somone could give me a step by step lesson on how to use this.
My channels triggers are suffering badly, and i could do with this, what looks like, amazing god saviour.

happy xmas
pan

 Respond  
Typo   -  Mar 02, 2009

Was grabbing this to give to someone and notices it could use some updating so I updated to simplify code with some $v1's, and a couple other small changes. It works exactly the same in every way, just less code is all.

Now nobody can say I haven't done anything on Hawkee lately. LOL

Typo

 Respond  
Typo   -  Dec 09, 2008

Good idea brando, I didn't see this post until now or would have done it sooner.

To be honest I'm not sure why the heck I didnt use $true and $false in the first place but hey, if I'm not being goofy then I'm not being me so oh well.

 Respond  
BrAndo   -  Nov 09, 2008

Why not return $true or $false instead of go or stop, seems more practical

 Respond  
^Neptune   -  Nov 05, 2008

Hmm, how could I make it so after the "Last warning" bit, it will ignore the nick on that command for 5mins?

 Respond  
^Neptune   -  Sep 26, 2008

Just haven't had a chance to look through your previous ones. :P

They really didn't get the attention they deserved.

 Respond  
Typo   -  Sep 26, 2008

Lol, thanks man, and once again thanks for going mad on all my scripts.

 Respond  
^Neptune   -  Sep 26, 2008

Woah, I actually REALLY love this. You don't have to put some shitty flood protection for every command you do! :O

I'm SO gonna use this on my bot.

10/10, works perfectly.

 Respond  
Jamiie   -  Jul 08, 2008

I\'m agree with EL. :P

8/10

 Respond  
EL   -  Jul 07, 2008

_> Nice way to protect all your commands rather then writing 4239048230 separate pros for each command or script.Very nice;p

 Respond  
Typo   -  Jul 07, 2008

I decided to leave any duration editing in the var -u## up to the user instead of making this a huge code with settings or dialogs.

Any input is welsome.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.