This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Mass Kick Protection

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
g
gamble27
Halfop
Posts: 71
Joined: Tue Aug 05, 2008 7:51 am

Mass Kick Protection

Post by gamble27 »

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
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

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.
g
gamble27
Halfop
Posts: 71
Joined: Tue Aug 05, 2008 7:51 am

Post by gamble27 »

/chanserv aop #channel del $nick <-- Del Command
/memoserv send #channel msg <-- memo command

Help appreciated
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Edit: see next page.
Last edited by caesar on Thu Mar 15, 2012 2:00 am, edited 6 times in total.
Once the game is over, the king and the pawn go back in the same box.
g
gamble27
Halfop
Posts: 71
Joined: Tue Aug 05, 2008 7:51 am

Post by gamble27 »

[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.
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

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]
	}
}
This should fix it.
g
gamble27
Halfop
Posts: 71
Joined: Tue Aug 05, 2008 7:51 am

Post by gamble27 »

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.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

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.
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

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.
proc doThis {act chan nick {pos "" count "" newNick ""}} {
See it now? :)
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Ahh, that lil bugger. 8) Thanks. :oops:
Once the game is over, the king and the pawn go back in the same box.
g
gamble27
Halfop
Posts: 71
Joined: Tue Aug 05, 2008 7:51 am

Post by gamble27 »

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 :)
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Gotcha! I wasn't sure about the variables I had in doThis proc.. Anyway, replace:

Code: Select all

proc doThis {act chan nick {pos "" count "" newNick ""}} { 
with:

Code: Select all

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.
g
gamble27
Halfop
Posts: 71
Joined: Tue Aug 05, 2008 7:51 am

Post by gamble27 »

i have updated the line u told me to and i face the same error still :< the one speechless corrected initially. Thanks
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

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.
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

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...
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"
Line 21: putquick "Chanserv aop $chan del $nick" -quick
What is -quick? Did you mean -next?
Line 24: return [doThis [list ["2" $chan $nick]]
There is no need to protect evaluations with
  • 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!!! :)
    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
    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
    Line 94: return [doThis [list "1" $chan $nick]]
    should be:
    doThis "1" $chan $nick
    Line 101: return [action [list $chan $nick]]
    should be:
    action $chan $nick
    Line 103: incr $count
    should be:
    incr count
    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.
Post Reply