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 

enforcebans

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
sdays
Halfop


Joined: 21 Oct 2006
Posts: 98

PostPosted: Sat Oct 21, 2006 4:53 am    Post subject: enforcebans Reply with quote

I need a enforcebans tcl that load's kick msg's from a txt file thx Very Happy
Back to top
View user's profile Send private message
Alchera
Revered One


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

PostPosted: Sat Oct 21, 2006 5:25 am    Post subject: Re: enforcebans Reply with quote

sdays wrote:
I need a enforcebans tcl that load's kick msg's from a txt file thx Very Happy

Search the forums as this has been done (from memory).
_________________
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
sdays
Halfop


Joined: 21 Oct 2006
Posts: 98

PostPosted: Sat Oct 21, 2006 6:44 pm    Post subject: Re: enforcebans Reply with quote

Yes, but i look, they don't kick from a txt file, and im a noob to edit it.
Back to top
View user's profile Send private message
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Sun Oct 22, 2006 5:43 am    Post subject: Reply with quote

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:

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..
Back to top
View user's profile Send private message
metroid
Owner


Joined: 16 Jun 2004
Posts: 771

PostPosted: Sun Oct 22, 2006 11:40 am    Post subject: Reply with quote

For a real random reason from a file:

Code:
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:
putserv "KICK #channel nickname :[getrandomreason]"


Or however you may wish to use it.
Back to top
View user's profile Send private message
sdays
Halfop


Joined: 21 Oct 2006
Posts: 98

PostPosted: Sun Oct 22, 2006 8:11 pm    Post subject: Reply with quote

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

Code:

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."
Back to top
View user's profile Send private message
caesar
Mint Rubber


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

PostPosted: Mon Oct 23, 2006 10:40 am    Post subject: Reply with quote

Instead of
Code:
set kickmsg "$enforce(kmsg)"
put
Code:
set kickmsg [getrandomreason]
and use metroid's code.
_________________
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
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
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