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 

Enforce Ban
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
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Wed Sep 20, 2006 8:58 am    Post subject: Reply with quote

i.m.offline wrote:
sorry for bothering again, if I want to exempt Bot users from being kicked as well, how can I add it? Please suggest so I will give a try. Thx

Code:
  matchattr <handle> <flags> [channel]
    Returns: 1 if the specified user has the specified flags; 0 otherwise

For a list of the user flags type the following in the party line:
Code:
.help whois

_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
i.m.offline
Halfop


Joined: 02 Mar 2006
Posts: 74

PostPosted: Sat Sep 23, 2006 7:21 am    Post subject: Reply with quote

is it something like
if {[matchattr $hand o]} { return 1 }

where do I have to add this line, tried adding some places but couldn't make it work :/
Back to top
View user's profile Send private message
r0t3n
Owner


Joined: 31 May 2005
Posts: 507
Location: UK

PostPosted: Sat Sep 23, 2006 10:37 am    Post subject: Reply with quote

Code:
bind mode - "* +b" enforcebans

set enforce(max) "8"
set enforce(kmsg) "Banned :ban: by :nick:"

proc enforcebans {nick uhost hand chan mc ban} {
  global enforce botname
  if {![botisop $chan]} { return }
  set ban [string map {"\\" "\\\\" "\[" "\\["} $ban]
  if {[string match -nocase $ban $botname]} { return }
  set kickmsg "$enforce(kmsg)"
  regsub -all :ban: $kickmsg $ban kickmsg
  regsub -all :nick: $kickmsg $nick kickmsg
  set list ""
  foreach user [chanlist $chan] {
    if {[matchattr [nick2hand $user] f|f $chan]} { return }
    if {[string match -nocase $ban $user![getchanhost $user $chan]]} {
      lappend list $user
    }
  }
  if {[llength $list] == "0"} { return }
  if {[llength $list] > $enforce(max)} {
    putserv "MODE $chan -ob $nick $ban"
  } else {
    if {[llength $list] <= "3"} {
      putserv "KICK $chan [join $list ,] :$kickmsg"
    } else {
      set nlist ""
      foreach x $list {
        lappend nlist $x
        if {[llength $nlist] == "3"} {
          putserv "KICK $chan [join $nlist ,] :$kickmsg"
          set nlist ""
        }
      }
      if {[llength $nlist] != ""} {
        putserv "KICK $chan [join $nlist ,] :$kickmsg"
        set nlist ""
      }
    }
  }
}

putlog "Enforcebans loaded."


It will excempt bot users with the global and channel flag +f (friend flag).
_________________
r0t3n @ #r0t3n @ Quakenet
Back to top
View user's profile Send private message MSN Messenger
i.m.offline
Halfop


Joined: 02 Mar 2006
Posts: 74

PostPosted: Sat Sep 23, 2006 11:09 am    Post subject: Reply with quote

thanks for the help mate, but for some od reason, it doesn't kick at all nor it removes ban mask from flagged users :s despite of user being flagged or not.
Back to top
View user's profile Send private message
i.m.offline
Halfop


Joined: 02 Mar 2006
Posts: 74

PostPosted: Wed Sep 27, 2006 8:59 am    Post subject: Reply with quote

i have tried making few changes but still couldn't make it work. please help :/ thx
Back to top
View user's profile Send private message
honeybee
Halfop


Joined: 01 Jan 2006
Posts: 80

PostPosted: Wed Sep 27, 2006 7:29 pm    Post subject: Reply with quote

Code:
bind mode - "* +b" enforcebans

set enforce(max) "8"

proc enforcebans {nick uhost hand chan mc ban} {
  global enforce botname
  if {![botisop $chan]} { return }
  set ban [string map {"\\" "\\\\" "\[" "\\["} $ban]
  if {[string match -nocase $ban $botname]} { return }
  set list ""
  foreach user [chanlist $chan] {
    if {[matchattr [nick2hand $user] f|f $chan]} { return }
    if {[string match -nocase $ban $user![getchanhost $user $chan]]} {
      lappend list $user
    }
  }
  if {[llength $list] == "0"} { return }
  if {[llength $list] > $enforce(max)} {
    putserv "MODE $chan -ob $nick $ban"
    }
  }
}

putlog "Enforcebans loaded."


So this can only be used to check if a banned host is banning more than 8 users and what if i also wana check if its banning *!*@* so i can do it more quick, thanks if this code can be more better.
Back to top
View user's profile Send private message
i.m.offline
Halfop


Joined: 02 Mar 2006
Posts: 74

PostPosted: Thu Sep 28, 2006 2:31 am    Post subject: Reply with quote

when I tried using this code the bot quits giving error msg

invalid command name "}"
while executing
"}"
(file "scripts/enforcebans.tcl" line 22)
invoked from within

ya it should prvent *!*@* banmask too. thx in advance.
Back to top
View user's profile Send private message
krimson
Halfop


Joined: 19 Apr 2006
Posts: 86

PostPosted: Thu Sep 28, 2006 3:41 am    Post subject: Reply with quote

you have an extra closing bracket at the end of the script.. remove that and try again
Back to top
View user's profile Send private message Send e-mail
i.m.offline
Halfop


Joined: 02 Mar 2006
Posts: 74

PostPosted: Thu Sep 28, 2006 4:31 am    Post subject: Reply with quote

thx for the suggestion krimson

I did give try for that earlier. Bot doesn't react at all for this code. it doesn't kick at all for whatsoever mask it is.
Back to top
View user's profile Send private message
r0t3n
Owner


Joined: 31 May 2005
Posts: 507
Location: UK

PostPosted: Thu Sep 28, 2006 6:11 am    Post subject: Reply with quote

Try This:

Code:
bind mode - "* +b" enforcebans

set enforce(max) "8"
set enforce(kmsg) "Banned :ban: by :nick:"

proc enforcebans {nick uhost hand chan mc ban} {
  global enforce botname
  if {![botisop $chan]} { return }
  set ban [string map {"\\" "\\\\" "\[" "\\["} $ban]
  if {[string match -nocase $ban $botname]} { return }
  set kickmsg "$enforce(kmsg)"
  regsub -all :ban: $kickmsg $ban kickmsg
  regsub -all :nick: $kickmsg $nick kickmsg
  set list ""
  set continue "1"
  foreach user [chanlist $chan] {
    if {[matchattr [nick2hand $user] f|f $chan]} {
      putserv "MODE $chan -b $ban"
      putserv "NOTICE $nick :Ban removed with the reason: Matched a botusers hostmask."
      set continue "0"
      break
    if {[string match -nocase $ban $user![getchanhost $user $chan]]} {
      lappend list $user
    }
  }
  if {$continue} {
    if {[llength $list] == "0"} { return }
    if {[llength $list] > $enforce(max)} {
      putserv "MODE $chan -ob $nick $ban"
      putserv "NOTICE $nick :Ban removed with the reason: Exceeded the max of $enforce(max) bans."
    } else {
      if {[llength $list] <= "3"} {
        putserv "KICK $chan [join $list ,] :$kickmsg"
      } else {
        set nlist ""
        foreach x $list {
          lappend nlist $x
          if {[llength $nlist] == "3"} {
            putserv "KICK $chan [join $nlist ,] :$kickmsg"
            set nlist ""
          }
        }
        if {[llength $nlist] != ""} {
          putserv "KICK $chan [join $nlist ,] :$kickmsg"
          set nlist ""
        }
      }
    }
  }
}

putlog "Enforcebans loaded."

_________________
r0t3n @ #r0t3n @ Quakenet
Back to top
View user's profile Send private message MSN Messenger
i.m.offline
Halfop


Joined: 02 Mar 2006
Posts: 74

PostPosted: Thu Sep 28, 2006 8:05 am    Post subject: Reply with quote

bot quit with error

Code:

[08:04] missing close-brace
    while executing
"proc enforcebans {nick uhost hand chan mc ban} {
  global enforce botname
  if {![botisop $chan]} { return }
  set ban [string map {"\\" "\\\\" "\[" "..."
    (file "scripts/enforcebans.tcl" line 6)


:/ thx for trying mate n sparing time for me
Back to top
View user's profile Send private message
r0t3n
Owner


Joined: 31 May 2005
Posts: 507
Location: UK

PostPosted: Thu Sep 28, 2006 9:01 am    Post subject: Reply with quote

This code should work:

Code:
bind mode - "* +b" enforcebans

set enforce(max) "8"
set enforce(kmsg) "Banned :ban: by :nick:"

proc enforcebans {nick uhost hand chan mc ban} {
  global enforce botname
  if {![botisop $chan]} { return }
  set ban [string map {"\\" "\\\\" "\[" "\\["} $ban]
  if {[string match -nocase $ban $botname]} { return }
  set kickmsg "$enforce(kmsg)"
  regsub -all :ban: $kickmsg $ban kickmsg
  regsub -all :nick: $kickmsg $nick kickmsg
  set list ""
  set continue "1"
  foreach user [chanlist $chan] {
    if {[matchattr [nick2hand $user] f|f $chan]} {
      putserv "MODE $chan -b $ban"
      putserv "NOTICE $nick :Ban removed with the reason: Matched a botusers hostmask."
      set continue "0"
      break
    } elseif {[string match -nocase $ban $user![getchanhost $user $chan]]} {
      lappend list $user
    }
  }
  if {$continue} {
    if {[llength $list] == "0"} { return }
    if {[llength $list] > $enforce(max)} {
      putserv "MODE $chan -ob $nick $ban"
      putserv "NOTICE $nick :Ban removed with the reason: Exceeded the max of $enforce(max) bans."
    } else {
      if {[llength $list] <= "3"} {
        putserv "KICK $chan [join $list ,] :$kickmsg"
      } else {
        set nlist ""
        foreach x $list {
          lappend nlist $x
          if {[llength $nlist] == "3"} {
            putserv "KICK $chan [join $nlist ,] :$kickmsg"
            set nlist ""
          }
        }
        if {[llength $nlist] != ""} {
          putserv "KICK $chan [join $nlist ,] :$kickmsg"
          set nlist ""
        }
      }
    }
  }
}

putlog "Enforcebans loaded."

_________________
r0t3n @ #r0t3n @ Quakenet
Back to top
View user's profile Send private message MSN Messenger
i.m.offline
Halfop


Joined: 02 Mar 2006
Posts: 74

PostPosted: Thu Sep 28, 2006 1:32 pm    Post subject: Reply with quote

now its releasing all the bans set by anyone Sad
Back to top
View user's profile Send private message
r0t3n
Owner


Joined: 31 May 2005
Posts: 507
Location: UK

PostPosted: Fri Sep 29, 2006 6:50 am    Post subject: Reply with quote

Ok, this should be the last one now:

Code:
bind mode - "* +b" enforcebans

set enforce(max) "8"
set enforce(kmsg) "Banned :ban: by :nick:"

proc enforcebans {nick uhost hand chan mc ban} {
  global enforce botname
  if {![botisop $chan]} { return }
  set ban [string map {"\\" "\\\\" "\[" "\\["} $ban]
  if {[string match -nocase $ban $botname]} { return }
  set kickmsg "$enforce(kmsg)"
  regsub -all :ban: $kickmsg $ban kickmsg
  regsub -all :nick: $kickmsg $nick kickmsg
  set list ""
  set continue "1"
  foreach user [chanlist $chan] {
    if {![string match -nocase $nick $user] && [matchattr [nick2hand $user] f|f $chan] && ![isbotnick $user]} {
      putserv "MODE $chan -b $ban"
      putserv "NOTICE $nick :Ban removed with the reason: Matched a botusers hostmask."
      set continue "0"
      break
    } elseif {[string match -nocase $ban $user![getchanhost $user $chan]]} {
      lappend list $user
    }
  }
  if {$continue} {
    if {[llength $list] == "0"} { return }
    if {[llength $list] > $enforce(max)} {
      putserv "MODE $chan -ob $nick $ban"
      putserv "NOTICE $nick :Ban removed with the reason: Exceeded the max of $enforce(max) bans."
    } else {
      if {[llength $list] <= "3"} {
        putserv "KICK $chan [join $list ,] :$kickmsg"
      } else {
        set nlist ""
        foreach x $list {
          lappend nlist $x
          if {[llength $nlist] == "3"} {
            putserv "KICK $chan [join $nlist ,] :$kickmsg"
            set nlist ""
          }
        }
        if {[llength $nlist] != ""} {
          putserv "KICK $chan [join $nlist ,] :$kickmsg"
          set nlist ""
        }
      }
    }
  }
}

putlog "Enforcebans loaded."

_________________
r0t3n @ #r0t3n @ Quakenet
Back to top
View user's profile Send private message MSN Messenger
metroid
Owner


Joined: 16 Jun 2004
Posts: 771

PostPosted: Fri Sep 29, 2006 5:28 pm    Post subject: Reply with quote

Code:
bind mode - "* +b" enforcebans

set enforce(max) "8"
set enforce(kmsg) "Banned :ban: by :nick:"

proc enforcebans {nick uhost hand chan mc ban} {
  global enforce botname
  if {[botisop $chan]} {
    set ban [string map {"\\" "\\\\" "\[" "\\["} $ban]
    if {[string match $ban $botname]} {
      return 0
    }
    set reason [string map [list ":ban:" "$ban" ":nick" "$nick"] $enforce(kmsg)
    set list [list]
    set continue 1
    foreach user [chanlist $chan] {
      if {[isbotnick $user]} {
        continue
      } elseif {[matchattr [nick2hand $user] f|f $chan]} {
        pushmode $chan -b $ban
        set continue 0
        break
      } elseif {[string match -nocase $ban $user![getchanhost $user $chan]]} {
        lappend list $user
      }
    }
    if {$continue} {
      if {[set llist [llength $list]]} {
        if {$llist > $enforce(max)} {
          putserv "MODE $chan -ob $nick $ban"
        } else {
          if {$llist <= 3} {
            putserv "KICK $chan [join $list ,] :$reason"
          } else {
            for {set i 0;set temp [list];set j 0} {$i <= $llist} {incr i} {
              if {$j == 3 || $i == $llist} {
                if {$j > 0} {
                  putserv "KICK $chan [join $temp ,] :$reason"
                  set temp [list]
                  set j 0
                  if {$j == $llist} {
                    break
                  }
                }
                lappend temp [lindex $list $i]
                incr j
              }
            }
          }
        }
      }
    }
  }
}


Should work fine. [untested]
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