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 Previous  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
caesar
Mint Rubber


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

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

Meh.. I should take a break. I'm too tiered from work. Sad
_________________
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 3:36 pm    Post subject: Reply with quote

emmm so many errors, perhaps caesar must be tired Smile take a break bro. Speechless thanks for pointing out the errors. Caesar take ure time with the code, ill wait. Sincere appreciation for both of u thanks Smile
Back to top
View user's profile Send private message
caesar
Mint Rubber


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

PostPosted: Thu Mar 15, 2012 2:00 am    Post subject: Reply with quote

Code:

namespace eval MassKick {

  # self explanatory
  set mass(limit) "3:10"
  set memo(mass) "The AOP of %nick user on %chan channel has been deleted due to attempt to masskick."
  set memo(bot) "The AOP of %nick user on %chan channel has been deleted cos he kicked me."

  # don't count or do anything to people with local/global friend flag or whatever you wish
  set mass(friends) "f|f"

  # 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 takeAction {chan nick pos} {
    dropAOP $chan $nick "1"
    doThis "2" $chan $nick $pos
  }

  # bot kicked
  proc botKicked {chan nick} {
    dropAOP $chan $nick "2"
    resetChan $chan
  }

  # reset
  proc resetChan {chan} {
    channel set $chan massKicker {}
    channel set $chan massCount {}
  }

  # remove AOP, deop and send memo
  proc dropAOP {chan nick act} {
    variable memo
    switch -- $act {
      "1" {
        set message [string map -nocase [list "%chan" "$chan" "%nick" "$nick"] $memo(mass)]
      }
      "2" {
        set message [string map -nocase [list "%chan" "$chan" "%nick" "$nick"] $memo(bot)]
      }
    }
    putserv "Memoserv send $chan $message"
    putserv "Chanserv aop $chan del $nick"
    putserv "Chanserv deop $chan $nick"
  }

  # triggers:
  # 1 - add, 2 - remove, 3 - replace nick, 4 - replace count
  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
  }

  # triggers:
  # 1 - part & sign, 2 - nick change
  proc eventThis {event chan nick {newNick ""}} {
    set massKicker [channel get $chan massKicker]
    if {$nick ni $massKicker} return
    set pos [lsearch $massKicker $nick]
    switch -- $event {
      "1" {
        doThis "2" $chan $nick $pos
      }
      "2" {
        doThis "3" $chan $nick $pos "0" $newNick   
      }
    }
  }

  # part & sign
  proc remove {nick uhost handle chan {text ""}} {
    if {![channel get $chan massKick]} return
    if {[isbotnick $nick]} {
      resetChan $chan
      } else {
      eventThis "1" $chan $nick
    }
  }

  # nick
  proc nickCh {nick uhost handle chan newnick} {
    if {![channel get $chan massKick]} return
    if {[isbotnick $nick]} return
    eventThis "2" $chan $nick $newNick
  }


  # kick
  proc kicked {nick uhost hand chan target reason} {
    if {![channel get $chan massKick]} return
    variable mass
    if {[matchattr $hand $mass(friends) $chan]} return
    if {[isbotnick $nick]} return
    if {$nick eq "Chanserv"} return
    if {[isbotnick $target]} {
      botKicked $chan $nick
      return
    }
    set massKicker [channel get $chan massKicker]
    if {$nick ni $massKicker} {
      doThis "1" $chan $nick
      return
    }
    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]} {
      takeAction $chan $nick $pos
      return
      } else {
      incr count
    }
    utimer [lindex $info 1] [list [namespace current]::doThis "2" $chan $nick $pos]
    doThis "4" $chan $nick $pos $count
  }
}

Hope I've finally nailed down all bugs. Rolling Eyes 12 hours of work every day for past 3 weeks is finally gaining on me.. I need a break. Confused

As always, haven't tested anything, so you will be my guinea piggy. Smile Just load it on a test bot and report back if anything goes wrong.

PS: Do a .chanset #channel +massKick to activate it on #channel

Edit: fixed for good hopefully. Smile
Edit: #2 adjusted the defaults.
_________________
Once the game is over, the king and the pawn go back in the same box.


Last edited by caesar on Fri Mar 16, 2012 12:21 pm; edited 2 times in total
Back to top
View user's profile Send private message
gamble27
Halfop


Joined: 05 Aug 2008
Posts: 71

PostPosted: Fri Mar 16, 2012 3:04 am    Post subject: Reply with quote

im afraid there is still errors :
Quote:

[15:00] <(im> [07:00:31] Tcl error [::MassKick::kicked]: bad index "": must be integer?[+-]integer? or end?[+-]integer?
[15:00] <(im> [07:00:31] Tcl error [::MassKick::kicked]: bad index "": must be integer?[+-]integer? or end?[+-]integer?
[15:00] <(im> [07:00:31] Tcl error [::MassKick::kicked]: bad index "": must be integer?[+-]integer? or end?[+-]integer?
[15:00] <(im> [07:00:32] -ChanServ (service@dal.net)- vinkan has been successfully removed from the AOP list of #idsf
[15:00] <(im> [07:00:32] -ChanServ (service@dal.net)- DEOP of vinkan on #idsf was successful.
[15:00] -ChanServ:#makaveli- import has deopped vinkan
[15:00] <(im> [07:00:33] Tcl error in script for 'timer144':
[15:00] <(im> [07:00:33] bad index "": must be integer?[+-]integer? or end?[+-]integer?
[15:00] <(im> [07:00:33] Tcl error in script for 'timer145':
[15:00] <(im> [07:00:33] bad index "": must be integer?[+-]integer? or end?[+-]integer?
[15:00] <(im> [07:00:35] -MemoServ (service@dal.net)- Im does not wish to receive memos.
[15:00] -MemoServ- New memo from Import. For more information, use: /msg MemoServ@services.dal.net LIST

It sent me 3 memos of same thing so thts an error too. Thanks and take ure time Smile
Back to top
View user's profile Send private message
caesar
Mint Rubber


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

PostPosted: Fri Mar 16, 2012 4:05 am    Post subject: Reply with quote

Looks like I'll have to load this on a bot myself to debug this. Rolling Eyes
_________________
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
caesar
Mint Rubber


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

PostPosted: Fri Mar 16, 2012 7:27 am    Post subject: Reply with quote

Alright, I've loaded this on an eggdrop, ran some tests and finally I've nailed down all bugs. It should work smoothly now.
_________________
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: Fri Mar 16, 2012 10:21 am    Post subject: Reply with quote

now its working fine, but how can i set that it only deletes op when they reach certain kicks. for example i wanted 4 kicks in 1 sec or 2 sec but currently even 2 kicks its deleting the aop and sending memo. Working fine but where are the settings tht i can set and play ard with ? is it here --> set mass(limit) "1:20"

Thanks : )
Back to top
View user's profile Send private message
Regex
Voice


Joined: 19 Mar 2011
Posts: 19

PostPosted: Fri Mar 16, 2012 10:45 am    Post subject: Reply with quote

@caesar how can we use this without .chanset #channel <<

i need this script without .chanset option. my bot have to work in everychannel.. Smile
Back to top
View user's profile Send private message
heartbroken
Op


Joined: 23 Jun 2011
Posts: 106
Location: somewhere out there

PostPosted: Fri Mar 16, 2012 12:16 pm    Post subject: Reply with quote

.chanset * +masskick <-- for to run this script on all channels ...
_________________
Life iS Just a dReaM oN tHE wAy to DeaTh
Back to top
View user's profile Send private message
caesar
Mint Rubber


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

PostPosted: Fri Mar 16, 2012 12:18 pm    Post subject: Reply with quote

@gamble27 : yes, isn't that option self explanatory? Razz I left it with 1 to see if it's working or not.

@Clubber : first remove setudef flag massKick line then find and remove all instances of:
Code:

if {![channel get $chan massKick]} return

and it will work on all channels or do what heartbroken said. Smile
_________________
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: Fri Mar 16, 2012 1:17 pm    Post subject: Reply with quote

working extremely perfect now caesar, just wondering if we can add a check on the tcl to only works on aop. it shud nt affect sops and above. Tcl should only affect aops. Its wonderful job caesar Smile Thanks Smile
Back to top
View user's profile Send private message
caesar
Mint Rubber


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

PostPosted: Fri Mar 16, 2012 1:19 pm    Post subject: Reply with quote

Is there a command to to get the level of a certain user?
_________________
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
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Fri Mar 16, 2012 1:32 pm    Post subject: Reply with quote

Is this useful?

http://thommey.tclhelp.net/?page=scripts

and see: Arbitrary chanmodes (+q, +a)
Back to top
View user's profile Send private message
caesar
Mint Rubber


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

PostPosted: Fri Mar 16, 2012 2:25 pm    Post subject: Reply with quote

Not exactly, cos that script only maintains a list with users that the bot has seen them gaining a +/- a and o flags. I was looking for a way to view the access of a person and found the command I was looking for in Dalnet's Chanserv Info page.
Quote:

Syntax: /chanserv acc/access #channel [nick]

Information: This command lets an AOp or higher see what access he/someone else has to the channel. The access is displayed numerically, below are the definitions:
-2 = Channel is frozen or closed
-1 = AutoKICKed from the channel
0 = basic
10 = AutoOp
20 = SuperOp
30 = User has MANAGER access
40 = Has founder access via a NickServ access list mask
50 = Has founder access via identification to NickServ
60 = Has founder access via identification to ChanServ

If the USER is not online, the access will be 0.
Note: You must be an AOp or higher to use that command.

Give me some time and will make it "forgive" higher ranked users. Smile
_________________
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: Sat Mar 17, 2012 1:28 am    Post subject: Reply with quote

sure caesar take your time,another way to find out the access level its /chanserv why #channel nick, if it returns Sop,manager or founder. ignore it. It should only be activated for aops. Appreciate your work and take your time. Thanks Smile
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 Previous  1, 2, 3  Next
Page 2 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