Code: Select all
namespace eval MassKick {
set mass(limit) "3:10"
set mass(memo) "The aop of %nick user on %chan channel has been deleted due to attempt to masskick."
# don't edit below this line
setudef flag massKick
setudef str massKicker
setudef str massCount
# binds
bind kick * * [namespace current]::kicked
bind part - * [namespace current]::remove
bind sign - * [namespace current]::remove
bind nick - * [namespace current]::nickCh
# AOP removal and memo
proc action {chan nick} {
variable mass
putquick "Chanserv aop $chan del $nick" -next
set message [string map -nocase [list "%chan" "$chan" "%nick" "$nick"] $mass(memo)]
putserv "Memoserv send $chan $message"
return [doThis "2" $chan $nick]
}
# triggers
proc doThis {act chan nick {pos ""} {count ""} {newNick ""}} {
set massKicker [channel get $chan massKicker]
set massCount [channel get $chan massCount]
switch -- $act {
"1" {
lappend massKicker $nick
lappend massCount 1
}
"2" {
set massKicker [lreplace $massKicker $pos $pos]
set massCount [lreplace $massCount $pos $pos]
}
"3" {
set massKicker [lreplace $massKicker $pos $pos $newNick]
}
"4" {
set massCount [lreplace $massCount $pos $pos $count]
}
}
channel set $chan massKicker $massKicker
channel set $chan massCount $massCount
}
# reset
proc reset {chan} {
channel set $chan massKicker
channel set $chan massCount
}
proc botKicked {nick chan} {
# bot kicked.. remove user's AOP?
# putserv "Chanserv aop $chan del $nick"
return [reset $chan]
}
# part & sign
proc remove {nick uhost handle chan {text ""}} {
if {![channel get $chan massKick]} return
if {[isbotnick $nick]} {
return [reset $chan]
} else {
set massKicker [channel get $chan massKicker]
if {$nick in $massKicker} {
set pos [lsearch $massKicker $nick]
return [doThis "2" $chan $nick $pos]
}
}
}
# nick
proc nickCh {nick uhost handle chan newnick} {
if {![channel get $chan massKick]} return
if {[isbotnick $nick]} return
set massKicker [channel get $chan massKicker]
if {$nick in $massKicker} {
set pos [lsearch $massKicker $nick]
return [doThis "3" $chan $nick $pos "" $newnick]
}
}
# kick
proc kicked {nick uhost hand chan target reason} {
if {![channel get $chan massKick]} return
variable mass
if {[isbotnick $nick]} return
if {$nick eq "Chanserv"} return
if {[isbotnick $target]} {
return [botKicked $chan $nick]
}
set massKicker [channel get $chan massKicker]
if {$nick ni $massKicker} {
return [doThis "1" $chan $nick]
}
set pos [lsearch $massKicker $nick]
set massCount [channel get $chan massCount]
set count [lindex [split $massCount] $pos]
set info [split $mass(limit) :]
if {$count >= [lindex $info 0]} {
return [action $chan $nick]
} else {
incr count
}
utimer [lindex $info 1] [list doThis "2" $chan $nick]
return [doThis "4" $chan $nick $pos $count]
}
}
Code: Select all
proc doThis {act chan nick {pos "" count "" newNick ""}} {
Code: Select all
proc doThis {act chan nick {pos ""} {count ""} {newNick ""}} {
You sure? It seems there are still ALOT of errors in your code going unfixed...caesar wrote:I've copy/pasted the modified code and it load just fine on my eggdrop.. Re copy/paste the code and try again.
Line 21: ERROR: Bad option -quick to putquick
Line 24: ERROR: Could not complete statement.
One close bracket would complete the first line
One close bracket would complete the script body at line 25.
Line 66: ERROR: Wrong number of arguments (1) to "MassKick::doThis"
Line 77: ERROR: Unknown variable "newNick"
Line 77: ERROR: Wrong number of arguments (1) to "MassKick::doThis"
Line 94: ERROR: Wrong number of arguments (1) to "MassKick::doThis"
Line 101: ERROR: Wrong number of arguments (1) to "MassKick::action"
Line 103: NOTICE: Suspicious variable name "$count"
Line 106: ERROR: Wrong number of arguments (1) to "MassKick::doThis"
What is -quick? Did you mean -next?Line 21: putquick "Chanserv aop $chan del $nick" -quick
There is no need to protect evaluations withLine 24: return [doThis [list ["2" $chan $nick]]
Once again, causing wrong # of args, and a needless return. should be:Line 66: return [doThis [list "2" $chan $nick $pos]]
again with the needless stuff, and NewNick is wrong, it should be newnickLine 77: return [doThis [list "3" $chan $nick $pos "" $newNick]]
should be:Line 94: return [doThis [list "1" $chan $nick]]
should be:Line 101: return [action [list $chan $nick]]
should be:Line 103: incr $count
should be:Line 106: return [doThis [list "4" $chan $nick $pos $count]]