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:
you would use:
And with:
you would use:
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
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
}