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.

enforcebans help

Help for those learning Tcl or writing their own scripts.
Post Reply
f
flexboy
Voice
Posts: 8
Joined: Sun Feb 04, 2007 5:11 am

enforcebans help

Post by flexboy »

...
Last edited by flexboy on Tue Feb 24, 2026 6:56 pm, edited 1 time in total.
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Re: enforcebans help

Post by user »

flexboy wrote:Can some one help me with this it only kicks one user...
It should give you an error (and kick NO users) - apply proper indentation and you'll see where your error is (the foreach)
Have you ever read "The Manual"?
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

Did you try to "enhance" the script by adding random crap?
My original version was different, and not alot of IRCd's actually support kicking 3 people at the same time (I think)

Code: Select all

setudef flag enforcebans

set enforce(max)       8;
set enforce(reasons)   [list \
                       "Some kick message" \
                       "Another one!" \
                       "And yet another one!" \
                       ]

bind mode - "* +b" enforceban

proc enforceban {nick uhost hand chan mc ban} {
  global enforce
  if {[channel get $channel enforcebans] && [botisop $chan]} {
    set banmask [string map {"\\" "\\\\" "\[" "\\["} $ban]
    set reason [lindex $enforce(reasons) [rand [llength $enforce(reasons)]]]

    set list [list]
    foreach user [chanlist $chan] {
      if {[isbotnick $user] || [matchattr [nick2hand $user] f|f $chan]} {
        continue
      } elseif {[string match -nocase $banmask $user![getchanhost $user $chan]]} {
        lappend list $user
      }
    }

    if {[llength $list] > $enforce(max)} {
      putserv "MODE $chan -ob $nick $ban"
    } else {
      foreach user $list {
        putserv "KICK $chan $user :$reason"
      }
    }
  }
} 
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

metroid wrote:not alot of IRCd's actually support kicking 3 people at the same time (I think)
"putkick" and the conf variable "kick-method" exists for a reason - so you don't need to care about that in your scripts :)
And I think even fewer ircds have case sensitive bans... :wink:
Have you ever read "The Manual"?
f
flexboy
Voice
Posts: 8
Joined: Sun Feb 04, 2007 5:11 am

Post by flexboy »

...
Post Reply