Top

Typos !Trigger Protection


mIRC Code
+ 2 likes
Please Register to submit score.
Bookmark and Share
Average Score  7.0 (of 7 scores)
Date Added  Jul 07, 2008
Last Updated  Mar 11, 2009
Tags  command  flood  ignore  pro  protection  trigger 

Introduction

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:
Code:
on *:text:*:#testing1234:{ if ($1 == !trigger) { commands } }

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


And with:
Code:
on *:text:!Trigger:#testing1234:{ commands }

you would use:
Code:
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.
Quote:
¤Jul07¤08:18PM¤ {-%TyposBot-} !topten
-Jul07-08:18PM- <TypoAway> Top Ten list was displayed for the next ten lines but I pulled them.
¤Jul07¤08:18PM¤ {-%TyposBot-} !topten
-Jul07-08:18PM- <TypoAway> Sorry, flood protection is preventing !TopTen from triggering. Try again in about 10 seconds.
¤Jul07¤08:18PM¤ {-%TyposBot-} !topten
-Jul07-08:18PM- <TypoAway> 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


Grab the Code

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

  (10)  RSS
Typo
Comments: 224
 
mIRC Snippet:  Typos !Trigger Protection
Posted on Jul 7, 2008 10:54 pm
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.
EL
Comments: 1,125
 
mIRC Snippet:  Typos !Trigger Protection
Posted on Jul 7, 2008 10:55 pm
>_> Nice way to protect all your commands rather then writing 4239048230 separate pros for each command or script.Very nice;p
Jamiie
Comments: 167
 
mIRC Snippet:  Typos !Trigger Protection
Posted on Jul 8, 2008 12:12 am
I'm agree with EL. :P



8/10
^Neptune
Comments: 597
 
mIRC Snippet:  Typos !Trigger Protection
Posted on Sep 26, 2008 2:18 pm
Woah, I actually REALLY love this. You don't have to put some shoot flood protection for every command you do! :O

I'm SO gonna use this on my bot.

10/10, works perfectly.
Typo
Comments: 224
 
mIRC Snippet:  Typos !Trigger Protection
Posted on Sep 26, 2008 2:23 pm
Lol, thanks man, and once again thanks for going mad on all my scripts.

^Neptune
Comments: 597
 
mIRC Snippet:  Typos !Trigger Protection
Posted on Sep 26, 2008 2:24 pm
Just haven't had a chance to look through your previous ones. :P

They really didn't get the attention they deserved.
^Neptune
Comments: 597
 
mIRC Snippet:  Typos !Trigger Protection
Posted on Nov 5, 2008 12:38 pm
Hmm, how could I make it so after the "Last warning" bit, it will ignore the nick on that command for 5mins?
BrAndo
Comments: 28
 
mIRC Snippet:  Typos !Trigger Protection
Posted on Nov 9, 2008 8:16 pm
Why not return $true or $false instead of go or stop, seems more practical
Typo
Comments: 224
 
mIRC Snippet:  Typos !Trigger Protection
Posted on Dec 9, 2008 8:15 am
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.
Typo
Comments: 224
 
mIRC Snippet:  Typos !Trigger Protection
Posted on Mar 2, 2009 3:50 am
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

Commenting Options

Register or Login to Hawkee.com or use your Facebook or Twitter account by clicking the corresponding button below.

  
Bottom