Theoretically using puthelp is quite a good methode to prevent floodings. However too many putquick scritps often screw this.
I use a little helper for anti-flood protections I wrote myself.
Code: Select all
# # # # # # # # #
# decrease
# usage : decrease <var>
# return : 0 or 1 (can be discarded)
#
# info : usefull for save var decreasings, var cannot drop below 0 and no
# TCL error can occure
#
proc decrease {var} {
if {[info exists ::$var]} {
if {[set ::$var] <= 1} {
set ::$var 0
} else {
incr ::$var -1
}
return 0
} else {
putlog "decrease: Variable '$var' doesn't exist"
return 1
}
}
You should now create a global variable containing a counter check for this before you send the stuff. An abstract example would be:
Code: Select all
set example_c 0
proc example {nick host hand chan} {
if {$::example_c < 3} {
incr $::example_c
utimer 1 {decrease example_c}
#do stuff here
}
return 0
}
Some explanations:
- The helper function is used to avoid the variable to drop below 0 due to .rehash while there is a timer running
- The parameter to the helper function must be the variable name, not the variable content.
- the constants 3 and 1 in the above example reflect allowed executions x within the timespan y seconds. Note that 1 second can never be accurate, since utimer triggers on full seconds, therefore the actual timespan x is: 0s < x < 1s