| View previous topic :: View next topic |
| Author |
Message |
anotheregglover Voice
Joined: 13 Jan 2005 Posts: 38
|
Posted: Thu Apr 14, 2005 5:54 pm Post subject: Help with restrict.tcl |
|
|
I am using the restrict.tcl script to restrict access to one of my channels. I only have it loaded on one bot, but whenever a user(me on a different host in this case) enters, a random bot kicks him and it messes up the count. I tried taking out the newchanban part and having it just putserv the kick and ban, but it still doesnt work. Here is the script if anybody can help me with this:
| Code: | # Restricted access TCL V1.4
# by quantum @ dalnet
# what it does:
# k/b's anyone who's not in the bot's userfile and puts a kick counter in the message
####################################
# Values to modify
####################################
# What chan to restrict?
set r_chan "#electronica"
# Duration of ban in minutes (0 for perm)
set r_time 60
# File to add kick messages to
set r_msg "rkickmsgs"
# Flag needed to add msgs
set addflag "m"
# Flag required to msgs
set delflag "m"
###################################
# You may not modify it
##################################
bind join -|- "$r_chan *!*@*" r_kick
bind pub $addflag !addkickmsg r_addmsg
bind pub $delflag !delkickmsg r_delmsg
proc r_kick { nick uhost hand chan } {
global r_ban r_time r_chan r_msg
# create random kick number file and random kick msg file if not otherwise created (lazy bastard)
if {![file exists restrictkick]} {
set rnum [open restrictkick w]
puts $rnum "0"
close $rnum
}
if {![file exists r_msg]} {
set rmsg [open r_msg w]
puts $rnum "thou hast been neutralized"
putlog "*** Restrict 1.3 - Restrict Kick Msg File created with 1 default kick msg. Type !addkickmsg <msg> to add more."
close $rmsg
}
# get random kick msg
# if {[lindex [split $arg] 0] != ""} { set chan [lindex [split $arg] 0] }
if {(![file exists $r_msg]) || (![file readable $r_msg])} {
putserv "NOTICE $nick :Unable to read from file $r_msg."
} else {
set kmsg [r_getmsg]
}
if { ![validuser $hand] } {
set rnum [open restrictkick r]
gets $rnum knum
close $rnum
set cnum [expr $knum + 1]
set rnum [open restrictkick w]
puts $rnum "$cnum"
close $rnum
---------------------this is the part i changed to putserv kick and mode +b, but a random bot still kicks the user-------------------
newchanban $chan [string trimleft [maskhost [getchanhost $nick $chan]] ~] neutralized " $kmsg \[\002\037$cnum\002\037|\002\037$r_chan\002\037\]" $r_time
}
}
# Get random msg from file
proc r_getmsg { } {
global r_msg
set kmsg ""
set fd [open $r_msg r]
while {![eof $fd]} {
gets $fd text
if {$text != ""} {
lappend kmsg $text
}
}
close $fd
return [lindex $kmsg [rand [llength $kmsg]]]
}
# Add an msg
proc r_addmsg {nick uhost hand chan arg} {
global r_msg
set kmsg [join [lrange [split $arg] 0 end]]
if {$kmsg == ""} {
putserv "NOTICE $nick :Usage: !addkickmsg <kick msg>"
} else {
if {[prc_addmsg $kmsg]} {
putserv "NOTICE $nick :An msg msg was added to $r_msg."
} else {
putserv "NOTICE $nick :Unable to add msg to $r_msg."
}
}
return 1
}
# Delete an msg
proc r_delmsg {nick uhost hand chan arg} {
global r_msg
set kmsg [join [lrange [split $arg] 0 end]]
if {(![file exists $r_msg]) || (![file readable $r_msg])} {
putserv "NOTICE $nick :Unable to read from file $r_msg."
} else {
if {$kmsg == ""} {
putserv "NOTICE $nick :Usage: !delkickmsg <kick msg>"
} else {
if {[prc_delmsg $kmsg]} {
putserv "NOTICE $nick :An was deleted from $r_msg."
} else {
putserv "NOTICE $nick :Unable to delete msg from $r_msg."
}
}
}
return 1
}
proc prc_addmsg {kmsg} {
global r_msg
if {[catch {open $r_msg a} fd]} {
return 0
} else {
puts $fd $kmsg
close $fd
return 1
}
}
proc prc_delmsg {kmsg} {
global r_msg
set what ""
set msgrem 0
if {[catch {open $r_msg r} fd]} {
return 0
} else {
while {![eof $fd]} {
gets $fd text
if {[string tolower $text] != [string tolower $kmsg]} {
append what "$text\n"
} else {
set msgrem 1
}
}
close $fd
if {[catch {open $r_msg w} fd]} {
return 0
} else {
puts $fd $what
close $fd
return $msgrem
}
}
}
### End
putlog "Restrict 1.4 loaded <\037\002quantum\037\002>"
### Create kickmsg file if it doesn't exist
if {![file exists $r_msg]} {
set rmsg [open $r_msg w]
puts $rmsg "thou hast been neutralized"
putlog "*** Restrict 1.4 - Restrict Kick Msg File created with 1 default kick msg. Type !addkickmsg <msg> to add more."
close $rmsg
}
|
|
|
| Back to top |
|
 |
metroid Owner
Joined: 16 Jun 2004 Posts: 771
|
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Fri Apr 15, 2005 5:49 am Post subject: |
|
|
Why don't you first contact the author regarding any issues with the script? _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
|