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

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
s
sdays
Halfop
Posts: 98
Joined: Sat Oct 21, 2006 4:46 am

enforcebans

Post by sdays »

I need a enforcebans tcl that load's kick msg's from a txt file thx :D
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Re: enforcebans

Post by Alchera »

sdays wrote:I need a enforcebans tcl that load's kick msg's from a txt file thx :D
Search the forums as this has been done (from memory).
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
s
sdays
Halfop
Posts: 98
Joined: Sat Oct 21, 2006 4:46 am

Re: enforcebans

Post by sdays »

Yes, but i look, they don't kick from a txt file, and im a noob to edit it.
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

There are a lot of posts about reading/writing to/from text files. It's not that hard. I'd suggest making it simpler by just putting your random kick msgs into the script itself, like:

Code: Select all

bind pub o|o !kick kickproc

proc kickproc {nick uhost hand chan text} {
set text [split $text]

set kickmsgs {
{msg 1}
{msg 2}
{msg 3}
}

 set kickmsg [lindex $kickmsgs [rand [llength $kickmsgs]]]
 if {[isop $nick $chan] && [onchan [join $text] $chan]} {
      putkick $chan [join $text] "$kickmsg"
 }
}
Something like that..
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

For a real random reason from a file:

Code: Select all

proc getrandomreason {} {
  set file [open "YOURFILE" r]
  set data [split [read $file] \n]
  close $file

  return [lindex $data [rand [llength $data]]]
}
This can be used via

Code: Select all

putserv "KICK #channel nickname :[getrandomreason]"
Or however you may wish to use it.
s
sdays
Halfop
Posts: 98
Joined: Sat Oct 21, 2006 4:46 am

Post by sdays »

This is like something im looking for, but can someone edit it where it
can load from a txt file thanks :D

Code: Select all

bind mode - "* +b" enforcebans

set enforce(max) "8"
set enforce(kmsg) ""

proc enforcebans {nick uhost hand chan mc ban} {
   global enforce
    if {![botisop $chan]} { return }
   set ban [string map {"\\" "\\\\" "\[" "\\["} $ban]
   if {[string match -nocase $ban $::botnick]} { 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 $chan]} { continue }
      if {[string match -nocase $ban $user![getchanhost $user $chan]]} {
         lappend list $user
      }
   }
   if {[string match [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."
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Instead of

Code: Select all

set kickmsg "$enforce(kmsg)"
put

Code: Select all

set kickmsg [getrandomreason]
and use metroid's code.
Once the game is over, the king and the pawn go back in the same box.
Post Reply