He this should be simple, but i cant seem to find the right keyword to search it....
how would i set a lock on my command to prevent it from over using,
like if you type
!show
!show
you would get : Please wait at least 5 minutes to re-use this command
Last edited by Way2Death on Tue Apr 07, 2009 2:21 pm, edited 1 time in total.
set vFlood [expr {[unixtime] - 300}]
bind PUB - !show pShow
proc pShow {nick uhost hand channel txt} {
global vFlood
if {[expr {[unixtime] - $vFlood}] > 299} {
set vFlood [unixtime]
# your code here
} else {putserv "PRIVMSG $channel :sorry $nick, there is a 5 minute wait between successive uses of the command !show"}
return 0
}
arfer wrote:It doesn't have a specific name. It is simply one method of preventing overuse of a command. Command flood control I suppose you could say.
All right, thanks so much =D i appreciate the help!
I believe the most common term is "throttling".
I recall user posted a nice proc (function) called "throttled" a long time ago, to make it simple to add such checks to any code. A quick search in the forum would probably reveal it. (arfer's code should do the trick just as well).