| View previous topic :: View next topic |
| Author |
Message |
sdays Halfop
Joined: 21 Oct 2006 Posts: 98
|
Posted: Sat Oct 21, 2006 4:53 am Post subject: enforcebans |
|
|
I need a enforcebans tcl that load's kick msg's from a txt file thx  |
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Sat Oct 21, 2006 5:25 am Post subject: Re: enforcebans |
|
|
| sdays wrote: | I need a enforcebans tcl that load's kick msg's from a txt file thx  |
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 |
|
 |
sdays Halfop
Joined: 21 Oct 2006 Posts: 98
|
Posted: Sat Oct 21, 2006 6:44 pm Post subject: Re: enforcebans |
|
|
| Yes, but i look, they don't kick from a txt file, and im a noob to edit it. |
|
| Back to top |
|
 |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
Posted: Sun Oct 22, 2006 5:43 am Post subject: |
|
|
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 |
|
 |
metroid Owner
Joined: 16 Jun 2004 Posts: 771
|
Posted: Sun Oct 22, 2006 11:40 am Post subject: |
|
|
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 |
|
 |
sdays Halfop
Joined: 21 Oct 2006 Posts: 98
|
Posted: Sun Oct 22, 2006 8:11 pm Post subject: |
|
|
This is like something im looking for, but can someone edit it where it
can load from a txt file thanks
| 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 |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Mon Oct 23, 2006 10:40 am Post subject: |
|
|
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 |
|
 |
|