| View previous topic :: View next topic |
| Author |
Message |
awyeah Revered One

Joined: 26 Apr 2004 Posts: 1580 Location: Switzerland
|
Posted: Tue Jul 24, 2007 11:18 am Post subject: Modified version of chanlimit.tcl by slennox |
|
|
Script requested by BrewMaster. Modified version of chanlimit.tcl by slennox.
| Quote: |
(*) Changed timer to utimer
(*) Added bind and proc for on join delay limit change for large channels
|
| Code: |
##############################
## ------------------------ ##
## 10. Channel Limit Script ##
## ------------------------ ##
##############################
#Channels in which to activate limiting, this should be a list like
#"#elephants #wildlife #etc". Leave it set to "" if you wish to activate
#limiting on all channels the bot is on.
set cl_chans "#awyeah"
#Limit to set (number of users on the channel + this setting)
set cl_limit "5"
#Limit grace (if the limit doesn't need to be changed by more than this,
#don't bother setting a new limit)
set cl_grace "2"
# Frequency of checking whether a new limit needs to be set (in seconds)
set cl_utimer "8"
bind join - "*" limit:chng:on:bot:join
proc limit:chng:on:bot:join {nick uhost hand chan} {
global cl_chans limit_delay
if {[isbotnick $nick] && ([lsearch -exact [split [string tolower $cl_chans]] [string tolower $chan]] != -1)} {
set limit_delay([string tolower $chan]) 1
utimer 3 [list unset limit_delay([string tolower $chan])]
}
}
proc cl_dolimit {} {
global cl_chans cl_limit cl_grace cl_utimer limit_delay
utimer $cl_utimer cl_dolimit
foreach chan [string tolower [channels]] {
if {$cl_chans != ""} {
if {([lsearch -exact [split [string tolower $cl_chans]] [string tolower $chan]] == -1)} { continue }
}
if {[info exists limit_delay($chan)]} { continue }
if {![botisop $chan]} { continue }
set numusers [llength [chanlist $chan]]
set newlimit [expr $numusers + $cl_limit]
if {[string match "*l*" [lindex [getchanmode $chan] 0]]} {
set currlimit [string range [getchanmode $chan] [expr [string last " " [getchanmode $chan]] + 1] end]
} else {
set currlimit 0
}
if {$newlimit == $currlimit} { continue }
if {$newlimit > $currlimit} {
set difference [expr $newlimit - $currlimit]
} elseif {$currlimit > $newlimit} {
set difference [expr $currlimit - $newlimit]
}
if {$difference <= $cl_grace} { continue }
putquick "MODE $chan +l $newlimit" -next
}
}
proc cl_startlimit {} {
global cl_utimer
if {[string match "*cl_dolimit*" [utimers]]} { return 0 }
utimer $cl_utimer cl_dolimit
}
cl_startlimit
|
_________________ ·awyeah·
==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
================================== |
|
| Back to top |
|
 |
BrewMaster Voice
Joined: 07 Jul 2007 Posts: 34
|
Posted: Thu Jul 26, 2007 11:06 am Post subject: |
|
|
Perfect awyeah...exactly what i was looking for!
(what other scripts do you have hidden under your mouse pad???)
Thanks,
brew |
|
| Back to top |
|
 |
|