Code: Select all
bind pub - .timer start:timer
bind pub - .stop stop:timer
proc start:timer {nick host hand chan text} {
global channel msg interval id
if {[string equal -nocase #chan $chan]} {
if {[isop $nick $chan]} {
set name $nick
set interval [lindex $text 0]
set channel [lindex $text 1]
set msg [lrange $text 2 end]
utimer $interval timer
putserv "NOTICE $nick :Starting timer Message: \"$msg \" Every $interval seconds"
}
}
}
proc timer {} {
global channel msg interval timerID
putserv "PRIVMSG $channel :$msg "
utimer $interval timer
}
proc stop:timer {nick host hand chan text} {
putserv "NOTICE $nick :Timer stopped"
foreach t [utimers] {
if [string match *stop:timer* [lindex $t 1]] {
killutimer [lindex $t end]
}
}
return 1
}