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 

Modified version of chanlimit.tcl by slennox

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
awyeah
Revered One


Joined: 26 Apr 2004
Posts: 1580
Location: Switzerland

PostPosted: Tue Jul 24, 2007 11:18 am    Post subject: Modified version of chanlimit.tcl by slennox Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
BrewMaster
Voice


Joined: 07 Jul 2007
Posts: 34

PostPosted: Thu Jul 26, 2007 11:06 am    Post subject: Reply with quote

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

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

Thanks,

brew
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 Support & Releases 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