egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Mass Kick Protection
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
gamble27
Halfop


Joined: 05 Aug 2008
Posts: 71

PostPosted: Mon Mar 12, 2012 2:24 am    Post subject: Mass Kick Protection Reply with quote

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
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Mon Mar 12, 2012 3:58 am    Post subject: Reply with quote

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
View user's profile Send private message
gamble27
Halfop


Joined: 05 Aug 2008
Posts: 71

PostPosted: Mon Mar 12, 2012 6:38 am    Post subject: Reply with quote

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

Help appreciated
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Mon Mar 12, 2012 12:13 pm    Post subject: Reply with quote

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
View user's profile Send private message
gamble27
Halfop


Joined: 05 Aug 2008
Posts: 71

PostPosted: Tue Mar 13, 2012 3:45 am    Post subject: Reply with quote

[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
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Tue Mar 13, 2012 7:31 am    Post subject: Reply with quote

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
View user's profile Send private message
gamble27
Halfop


Joined: 05 Aug 2008
Posts: 71

PostPosted: Tue Mar 13, 2012 9:07 am    Post subject: Reply with quote

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
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Tue Mar 13, 2012 9:40 am    Post subject: Reply with quote

I've updated my first code, hopefully nailed all errors. Smile 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
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Tue Mar 13, 2012 6:25 pm    Post subject: Reply with quote

caesar wrote:
I've updated my first code, hopefully nailed all errors. Smile 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? Smile
_________________
speechles' eggdrop tcl archive
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Wed Mar 14, 2012 1:22 am    Post subject: Reply with quote

Ahh, that lil bugger. Cool Thanks. Embarassed
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
gamble27
Halfop


Joined: 05 Aug 2008
Posts: 71

PostPosted: Wed Mar 14, 2012 4:25 am    Post subject: Reply with quote

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 Smile
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Wed Mar 14, 2012 6:51 am    Post subject: Reply with quote

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
View user's profile Send private message
gamble27
Halfop


Joined: 05 Aug 2008
Posts: 71

PostPosted: Wed Mar 14, 2012 7:41 am    Post subject: Reply with quote

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
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Wed Mar 14, 2012 8:44 am    Post subject: Reply with quote

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
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Wed Mar 14, 2012 12:03 pm    Post subject: Reply with quote

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!!! Smile

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber