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.

Modified version of chanlimit.tcl by slennox

Support & discussion of released scripts, and announcements of new releases.
Post Reply
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Modified version of chanlimit.tcl by slennox

Post by awyeah »

Script requested by BrewMaster. Modified version of chanlimit.tcl by slennox.
(*) Changed timer to utimer
(*) Added bind and proc for on join delay limit change for large channels

Code: Select all

##############################
## ------------------------ ##
## 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.
==================================
B
BrewMaster
Voice
Posts: 34
Joined: Sat Jul 07, 2007 8:26 am

Post by BrewMaster »

Perfect awyeah...exactly what i was looking for!

(what other scripts do you have hidden under your mouse pad???)

Thanks,

brew
Post Reply