Can anyone convert this code to make it work even if my eggdrop is op on many channels.
The code works fine now because my eggie is op on just 1 channel, but I want to op it on many. If I use the current code and the same nick join 2 different channels, it will trigger a ban which is wrong.
Here's the code:
set nickjoinlast ""
set nickjointimes 0
set nickjoinsafe 0
bind join - * nickjoin
proc nickjoin {nick uhost hand chan} {
global nickjoinlast nickjointimes nickjoinsafe
if {$nickjoinlast != ""} {
if {"$nickjoinlast" == "$nick"} {
if {$nickjointimes >= 3} {
if {$nickjoinsafe == 0} {
putquick "MODE $chan +b $nick!*@*" -next
set nickjoinsafe 1
utimer 20 {set nickjoinsafe 0}
}
} else {
set nickjointimes [expr $nickjointimes + 1]
}
} else {
set nickjoinlast $nick
if ([info exists mynickjointimer]) { killutimer $mynickjointimer }
set mynickjointimer [utimer 10 {set nickjoinlast ""}]
set nickjointimes 1
}
} else {
set nickjoinlast $nick
if ([info exists mynickjointimer]) { killutimer $mynickjointimer }
set mynickjointimer [utimer 10 {set nickjoinlast ""}]
}
}
<font size=-1>[ This Message was edited by: z_one on 2002-02-19 06:38 ]</font>
Can anyone help guys. I really and urgently need this code to work when the eggdrop is op on multiple channels (I tried using arrays for variable and timer names to make them channel specific, didn't work).
Slennox, Egghead, Petersen, Ppslim or anyone else out there ?
why would I wanna unset the timerID. I need to keep track of it to kill it later on
"killutimer $myipjointimer($chan)" before starting a new one. Otherwise, I'll end up having so many timers if I don't stop the current one before starting a new one. right ?
I got your point. But even when I unset the timer as u proposed, I am still getting the msg "Invalid Timer ID"
All I want to do is:
1- Check if a channel specific timer exists - say it's called mytimer(#mychan)
2- If it doesn't exist then simply set it for 10 seconds to perform an action.
3- If it exists, kill it first then set it again for another 10 seconds. The reason I wanna kill it is because I don't wanna set the timer with a diff. ID everytime someone joins ... if there's a fast flood it will probably make the bot crash.
I just wanna kill the timer and set it again with the SAME ID for a specific channel.
<font size=-1>[ This Message was edited by: z_one on 2002-02-25 01:40 ]</font>
I adjusted the code. Thanks for ur help Petersen and sorry for asking too many questions.
I used "foreach timr [utimers]" to check for timer existance on "[lindex $timr 2]" and kill it.