I know how to make a auto voice script but don't know how to includes those time range in my script

proc pub:onjoin {nick uhost hand chan} {
putserv "MODE $chan +v $nick"
return 1
}
Code: Select all
proc pub:onjoin {nick uhost handle channel} {
set hour [clock format [clock seconds] -format "%k"]
if {$hour == 23 || $hour < 8} {
pushmode $channel +v $nick
}
}
Code: Select all
.. ($h >= $vStartHour) && ($h >= $vEndHour) ..
Code: Select all
.. ($h <= $vStartHour) && ($h <= $vEndHour) ..
Code: Select all
set vStartHour 23
set vEndHour 8
set vGmtOffset +1
set vVoiceDelay 10
bind JOIN - * pTimedVoiceJoin
proc pTimedVoiceJoin {nick uhost hand chan} {
global vGmtOffset vStartHour vEndHour vVoiceDelay
set hour [expr {[clock format [clock seconds] -format %k -gmt 1] + $vGmtOffset}]
# {if statement needed here for checking if within bound} {
utimer $vVoiceDelay [list pTimedVoiceDelay $nick $chan]
# }
return 0
}
proc pTimedVoiceDelay {nick chan} {
if {[botisop $chan]} {
if {[onchan $nick $chan]} {
if {(![isop $nick $chan]) && (![isvoice $nick $chan])} {
pushmode $chan +v $nick
flushmode $chan
}
}
}
return 0
}
# eof
Code: Select all
if {$hour >= $start && $hour < $end || ($hour >= $start || $hour < $end) && $start > $end} {
Code: Select all
# set some global vars up with contents
# voice delay (in minutes) this is to prevent a
# flood of voices during a netsplit rejoin, or
# rogue users flooding your channel.
variable vVoiceDelay 10
# hour to start voice (24 hour)
variable vStartHour 23
# hour to stop voicing (24 hour)
variable vEndHour 8
# init voicelist
variable voicelist [list]
# init timer to check list, so if a flood of joins occurs
# in that period, we can stuff as many modes on one line
# as possible in as many channels as possible.
timer $vVoiceDelay timer:onjoin
proc pub:onjoin {nick uhost handle channel} {
# maybe this is nml375's code :)
set hour [clock format [clock seconds] -format "%k"]
if {$hour >= $::vStartHour && $hour < $::vEndHour || ($hour >= $::vStartHour || $hour < $::vEndHour) && $::vStartHour > $::vEndHour} {
# create a single in-line voicelist, checking that
# a rotating nickname gets added only once.
if {[lsearch -exact $::voicelist [string tolower $nick]] == -1} {
lappend ::voicelist [string tolower $nick] $uhost $handle $channel
}
}
}
proc timer:onjoin { } {
set channellist [list]
# iterate through the in-line voicelist
foreach {nick uhost handle channel} $::voicelist {
# conditionals
if {[botisop $channel] && [onchan $nick $channel] && ![isvoice $nick $channel]} {
pushmode $channel +v $nick
# for the flushmode below to work we need to track every chan
# we've done any mode changes through. to keep this list short
# and no channels repeated, i propose an lsearch. i know this
# would be executed at the end of the proc anyways. this is
# for style points.. :P
if {[lsearch -exact $channellist $channel] == -1} {
lappend $channellist $channel
}
}
}
# STYLE POINTS! this is totally unnecessary, but it looks cool.
foreach $chan $channelist {
flushmode $chan
}
# clear voicelist for next flush
set ::voicelist [list]
# recall timer to check next joiners
timer $::vVoiceDelay timer:onjoin
}
Not to be rude sir, but your code will flood a channel in the event of a flood of joins. Be this a netsplit, rogue users, etc. I would rather think you at your caliber of this field you would be more caring. But i digress....nml375 wrote:Speechles,
Not to be rude, but the expression you've entered is not even remotely close to what I've suggested! Also, it is severely flawed.
Please do not attach my signature with some random piece of code.