I have this script it is a clone detector and a channel locker script.
I am having problems with else and if statements, if someone could
help me with the error it would be greatful.
Code: Select all
Tcl error [clonejoin]: wrong # args: extra words after "else" clause in "if" command
Code: Select all
bind join - * clonejoin
proc clonejoin {nick uhost hand chan} {
global cp_chans cp_j_flood cp_jp_flood cp_btime cp_host_count cp_uh_count clonebantime
set uhost [string tolower $uhost]
set host [lindex [split $uhost @] 1]
set chan [string tolower $chan]
set banmask "*!*@[lindex [split $uhost @] 1]"
set joinpartsplit [lindex [split $cp_j_flood ":"] 0]; set joinparttimes [lindex $joinpartsplit 0]; set joinpartsecs [lindex $joinpartsplit 1]
if {(([lsearch -exact [split [string tolower $cp_chans]] [string tolower $chan]] == -1) || ($cp_chans == "*"))} {return 0}
if {![info exists cp_host_count($host:$chan)]} {
set cp_host_count($host:$chan) 1
} else {
incr cp_host_count($host:$chan)
}
utimer [lindex $cp_j_flood 1] [list cp_expire cp_host_count($host:$chan)]
if {$cp_host_count($host:$chan) > [lindex $cp_j_flood 0]} {
newchanban $chan *!*@$host clones "2(Excessive Clones 12from:6 *!*@$host2)" 30
if {[botisop $chan]} {
enforce:flood:mlock $chan
putquick "KICK $chan $nick :2(Excessive Clones 12from:6 *!*@$host2)" -next
utimer 1 [list scan:remove:clones $banmask $host $nick $chan]
}
}
if {![info exists cp_uh_count($uhost:$chan)]} {
set cp_uh_count($uhost:$chan) 1
} else {
incr cp_uh_count($uhost:$chan)
}
utimer [lindex $cp_jp_flood 1] [list cp_expire cp_uh_count($uhost:$chan)]
if {$cp_uh_count($uhost:$chan) >= [expr [lindex $cp_jp_flood 0]*2]} {
newchanban $chan *!*@$host clones "2(Excessive Clones 12from:6 *!*@$host2)" 30
if {[botisop $chan]} {
enforce:flood:mlock $chan; set list [list]
putquick "KICK $chan $nick :2(Excessive Clones 12from:6 *!*@$host2)" -next
foreach user [chanlist $chan] {
if {[string equal -nocase $user $nick]} { continue }
if {[string match -nocase $banmask "${nick}![getchanhost $user $chan]"]} { lappend list $user }
}
putquick "KICK $chan [join $list {,}] :0,1 Mass Join/Part Flood Kick 12,0 - 12Detected 2multiple 12clients cycling in here with the 2host6 $banmask 12performing2 $joinparttimes 12or more2 join/part cycles,12 in less than2 $joinpartsecs secs." -next
timer $clonebantime "pushmode $chan -b *!*@$host"
}
}
}
proc enforce:flood:mlock {chan} {
global botnick allmodes mlockswitch mlock mlock1 mlock2 noticeswitch clonenotice mlockremove
set checkmode [split [string trim [lindex [split [getchanmode $chan]] 0] "+"] ""]
if {($mlockswitch == 1) && ($mlock != "") && ((![string match *$checkmode* *$allmodes*]) || (![string match *$checkmode* $mlock]) || (![string match *$checkmode* $mlock1]) || (![string match *$checkmode* $mlock2]))} {
putquick "MODE $chan +$allmodes" -next; set modeslocked 1
}
if {($noticeswitch == 1) && ($clonenotice != "")} {
putquick "NOTICE $chan :$clonenotice"
}
if {($mlockremove == "") || ($mlockremove == "0") || ($mlockremove < "1")} { set $mlockremove 10 }
utimer $mlockremove [list remove:flood:mlock $chan]
return 1
}
proc remove:flood:mlock {chan} {
global botnick allmodes mlock mlock1 mlock2
set checknewmode [split [string trim [lindex [split [getchanmode $chan]] 0] "+"] ""]
if {($mlock1 == "")} { set mlock1 $mlock }; if {($mlock2 == "")} { set mlock2 $mlock }
if {([string match *$checknewmode* *$allmodes*]) || ([string match *$checknewmode* $mlock]) || ([string match *$checknewmode* $mlock1]) || ([string match *$checknewmode* $mlock2])} {
putserv "MODE $chan -$allmodes"
return 1
}
}
proc scan:remove:clones {banmask host nick chan} {
global botnick clonebantime
set list [list]
foreach user [chanlist $chan] {
if {[string equal -nocase $user $nick]} {continue}
if {[string match -nocase $banmask "${nick}![getchanhost $user $chan]"]} { lappend list $user }
}
putquick "KICK $chan [join $list ,] :0,1 Excessive Clone/Botnet Join Kick 2,0 - (Excessive Clones 12from host:6 *!*@$host2)" -next
timer $clonebantime "pushmode $chan -b *!*@$host"
return 1
}