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 »

Can some one help me with this it only kicks one user...

Code: Select all

setudef flag enforceban
bind mode - "* +b" enforceban
set enforce(max) "8"

set  enforce(kick) {
  "[na(k)]"
  "[BX]"
  "..(cyp/k) "
  "[pv!k]"
}

set enforce(kmsg) {
  "No pussy for you!"
  "Go sit on a penis."
  "cock sucking bathroom queen."
  "too bad you won't see the hot titties now."
  "[censored] off."
  "buttslut."
  "go lick that big ass hairy mole between your pussy lips."
  "[censored] face cock master."
  "gutter whore"
}

proc enforceban {nick uhost hand chan mc ban} {
  global enforce
  if {[botisop $chan]} {
    if {![string match *+enforceban* [channel info $chan]]} {return 0}
    if {[botisop $chan]} {

      set ban [string map {"\\" "\\\\" "\[" "\\["} $ban] 
      set reason [lindex $enforce(kick) [rand [llength $enforce(kick)]]]
      set reason2 [lindex $enforce(kmsg) [rand [llength $enforce(kmsg)]]]


      set list [list]
      foreach user [chanlist $chan] {
        if {[isbotnick $user]} {
          continue
        } elseif {[matchattr [nick2hand $user] f|f $chan]} { return } 
        continue
        } elseif {[string match -nocase [string map {"\\" "\\\\" "\[" "\\["} $ban] $nick![getchanhost $nick $chan]} {
        lappend list $user
      }
    }

    if {[set llist [llength $list]] > $enforce(max)} {
      putserv "MODE $chan -ob $nick $ban"
      } 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 reason2"
            set temp [list]
            set j 0
          }
        }
        lappend temp [lindex $list $i]
        incr j
      }
    }
  }
}
User avatar
user
&nbsp;
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
&nbsp;
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 »

Ok i got that now, i want when people change there nick and the nick is in the banlist it will auto kick them.
Post Reply