| View previous topic :: View next topic |
| Author |
Message |
gamble27 Halfop
Joined: 05 Aug 2008 Posts: 71
|
Posted: Mon Mar 12, 2012 2:24 am Post subject: Mass Kick Protection |
|
|
Im looking for a small mass kick code. Well if an aop kick more than 4 users in 1 sec then my eggdrop(sop level) will automatically delete the aop from op list and memo the channel that the aop has been deleted due to attempt to masskick. Plz note im on dalnet, so we uses Chanserv and Memoserv.
In recent times we have suffered from masskicks to often so we are finding a way to protect the channel 24/7 through this code. Any help will be appreciated. Thanks |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Mon Mar 12, 2012 3:58 am Post subject: |
|
|
What's the command to delete the aop and add a note? _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
gamble27 Halfop
Joined: 05 Aug 2008 Posts: 71
|
Posted: Mon Mar 12, 2012 6:38 am Post subject: |
|
|
/chanserv aop #channel del $nick <-- Del Command
/memoserv send #channel msg <-- memo command
Help appreciated |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Mon Mar 12, 2012 12:13 pm Post subject: |
|
|
Edit: see next page. _________________ Once the game is over, the king and the pawn go back in the same box.
Last edited by caesar on Thu Mar 15, 2012 2:00 am; edited 6 times in total |
|
| Back to top |
|
 |
gamble27 Halfop
Joined: 05 Aug 2008 Posts: 71
|
Posted: Tue Mar 13, 2012 3:45 am Post subject: |
|
|
[07:41:12] missing close-brace
while executing
"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 massk..."
(file "scripts/masskick.tcl" line 1)
invoked from within
"source scripts/masskick.tcl"
This is the error i get when i load on to eggdrop. Thanks and help appreciated. |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Tue Mar 13, 2012 7:31 am Post subject: |
|
|
| Code: | 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]
}
} |
This should fix it. _________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
gamble27 Halfop
Joined: 05 Aug 2008 Posts: 71
|
Posted: Tue Mar 13, 2012 9:07 am Post subject: |
|
|
i tried the tcl and found few errors :
1st) Tcl error [::MassKick::kicked]: bad index "": must be integer?[+-]integer? or end?[+-]integer?
2nd) Tcl error [::MassKick::kicked]: no such channel record <-- when eggdrop gets kicked
3rd) Tcl error in script for 'timer37': invalid command name "doThis"
4th) Tcl error in script for 'timer38': invalid command name "doThis"
Thanks, and help appreciated.
It does the deletion and send the memo out. but it has the following errors, and it will be great if it deletes the offender and deop him/her from the channel too. |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Tue Mar 13, 2012 9:40 am Post subject: |
|
|
I've updated my first code, hopefully nailed all errors. To be honest I don't see from where the 'missing close-brace' is coming. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Tue Mar 13, 2012 6:25 pm Post subject: |
|
|
| caesar wrote: | I've updated my first code, hopefully nailed all errors. To be honest I don't see from where the 'missing close-brace' is coming. |
| Quote: | | proc doThis {act chan nick {pos "" count "" newNick ""}} { |
See it now?  _________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Wed Mar 14, 2012 1:22 am Post subject: |
|
|
Ahh, that lil bugger. Thanks.  _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
gamble27 Halfop
Joined: 05 Aug 2008 Posts: 71
|
Posted: Wed Mar 14, 2012 4:25 am Post subject: |
|
|
Loaded the updated tcl. Bot crashed with the following error :
[16:22] <(im> [08:22:32] invalid command name " "
[16:22] <(im> while executing
[16:22] <(im> " "
[16:22] <(im> (in namespace eval "::MassKick" script line 4)
[16:22] <(im> invoked from within
[16:22] <(im> "namespace eval MassKick {
[16:22] <(im> set mass(limit) "3:10"
[16:22] <(im> set mass(memo) "The aop of %nick user on %chan channel has been deleted due to attempt to masskic..."
[16:22] <(im> (file "scripts/masskick.tcl" line 1)
[16:22] <(im> invoked from within
[16:22] <(im> "source scripts/masskick.tcl"
I think it is the first error which speechless fixed, in ure new edited code im facing same prob. Thanks for help  |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Wed Mar 14, 2012 6:51 am Post subject: |
|
|
Gotcha! I wasn't sure about the variables I had in doThis proc.. Anyway, replace:
| Code: |
proc doThis {act chan nick {pos "" count "" newNick ""}} {
|
with:
| Code: |
proc doThis {act chan nick {pos ""} {count ""} {newNick ""}} {
|
I've also updated the above code. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
gamble27 Halfop
Joined: 05 Aug 2008 Posts: 71
|
Posted: Wed Mar 14, 2012 7:41 am Post subject: |
|
|
| i have updated the line u told me to and i face the same error still :< the one speechless corrected initially. Thanks |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Wed Mar 14, 2012 8:44 am Post subject: |
|
|
I've copy/pasted the modified code and it load just fine on my eggdrop.. Re copy/paste the code and try again. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Wed Mar 14, 2012 12:03 pm Post subject: |
|
|
| 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. |
You sure? It seems there are still ALOT of errors in your code going unfixed...
| Quote: | 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" |
| Quote: | | Line 21: putquick "Chanserv aop $chan del $nick" -quick |
What is -quick? Did you mean -next?
| Quote: | | Line 24: return [doThis [list ["2" $chan $nick]] |
There is no need to protect evaluations with [list] here. All that does is cause the procedure to fail for wrong # of arguments. Also, why does it return things to eggdrops binds? Whats the purpose of having that return there at all? Also, you missed a closing bracket which is totally unnecessary as is, see line 25 below. It should just be:
doThis "2" $chan $nick
Line 25: sees the missing bracket from line 24. So it's not an error anymore since correcting line 24.. YAY!!!
| Quote: | | Line 66: return [doThis [list "2" $chan $nick $pos]] |
Once again, causing wrong # of args, and a needless return. should be:
doThis "2" $chan $nick $pos
| Quote: | | Line 77: return [doThis [list "3" $chan $nick $pos "" $newNick]] |
again with the needless stuff, and NewNick is wrong, it should be newnick
solves 2 problems, should be:
doThis "3" $chan $nick $pos "" $newnick
| Quote: | | Line 94: return [doThis [list "1" $chan $nick]] |
should be:
doThis "1" $chan $nick
| Quote: | | Line 101: return [action [list $chan $nick]] |
should be:
action $chan $nick
| Quote: | | Line 103: incr $count |
should be:
incr count
| Quote: | | Line 106: return [doThis [list "4" $chan $nick $pos $count]] |
should be:
doThis "4" $chan $nick $pos $count
______________________________________________________
This post was brought to you by paste.tclhelp.net, nagelfar and the letters T, C and L. _________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
|