Idle Kicker
Platform: mIRC
Published Mar 28, 2008
Updated Oct 18, 2010
This is an idle kicker that works across mulitple networks and in multiple channels. Settings are on a channel by channel basis, and are set/reset via channel menu. Settings are stored in a hash table.
Exemptions can be set based on access level (op, half-op, voice and/or regular) as well as by specific nick. NOTE: If the number of characters in the list of exempted nicks exceeds approximately 500, then an error will occur. I have not used binary variables to get around the length limitation, but if the average nick is 20 characters in length, then you still have room for about 25 nicks.
As of mIRC version 6.32, the aforementioned limit still exists, but has been greatly expanded to about 4000 characters, or 200 nicks at an average of 20 characters per nick.
Code edited per information from [85] in
this topic
Also checked against recent updates in mIRC to confirm that it works with version 7.14
ctcp *:version:*: ctcpreply $nick VERSION Idle Kicker 10.19.2010 by Russel Bairstow
on *:start:{
if !$hget(idle_kick) { .hmake idle_kick 10 }
if $exists($qt($scriptdiridlekick.hsh)) { .hload idle_kick $qt($scriptdiridlekick.hsh) }
load_idle
}
on *:exit:{
.timers off
.hsave -o idle_kick $qt($scriptdiridlekick.hsh)
}
on *:disconnect:{
$+(.timer,$network,*) off
.hsave -o idle_kick $qt($scriptdiridlekick.hsh)
}
menu channel {
Idle Kick
.$iif(!$idle($network,$chan),Set,Reset) Allowed idle time : idle $network $chan $iif($duration($$?="Time in hh:mm:ss format. Note that hh and mm are not required and will default to 0 if not supplied") isnum,$v1,$duration($v1))
.$iif($idle($network,$chan),Clear Idle Time $duration($idle($network,$chan),3)) : .hdel idle_kick $+($network,.,$chan,.,Idle)
.$iif(!$exempt($network,$chan),Set,Reset) Exempt Modes: {
var %exempt = $$?="Enter characters for exemption status (o = op, h = half-op, v = voice, r = regular)"
var %exempt1 = $remove(%exempt,o,h,v,r)
exempt $network $chan $remove(%exempt,%exempt1)
}
.$iif($exempt($network,$chan),Clear Exempt Modes $exempt($network,$chan)) : .hdel idle_kick $+($network,.,$chan,.,Exempt)
.Exempt Nick(s) : {
var %exempt.nicks = $replace($$?="Nick(s) to exempt",$chr(44),$chr(32))
var %a = 1, %b = $numtok(%exempt.nicks,32)
while %a <= %b {
.hadd -m idle_kick $+($network,.,$chan,.,Exempt.Nick) $addtok($hget(idle_kick,$+($network,.,$chan,.,Exempt.Nick)),$gettok(%exempt.nicks,%a,32),32)
inc %a
}
}
.Manual Check : check_idle $chan
}
on *:op:#:{
if $opnick == $me {
var %exempt = $hget(idle_kick,$+($network,.,$chan,.,Exempt)), %a = 1, %b = $nick($chan,0,a,%exempt)
while %a <= %b {
if !$istok($hget(idle_kick,$+($network,.,$chan,.,Exempt.Nick)),$nick($chan,%a,a,%exempt),32) {
$+(.timer,$network,.,$chan,.,$nick($chan,%a,a,%exempt)) -m 0 500 check_idle $chan $nick($chan,%a,a,%exempt)
}
inc %a
}
}
if o isin $exempt($network,$chan) && $timer($+($network,.,$chan,.,$opnick)) { $+(.timer,$network,.,$chan,.,$opnick) off }
}
on *:help:#:{
if h isin $exempt($network,$chan) && $timer($+($network,.,$chan,.,$hnick)) { $+(.timer,$network,.,$chan,.,$hnick) off }
}
on *:voice:#:{
if v isin $exempt($network,$chan) && $timer($+($network,.,$chan,.,$vnick)) { $+(.timer,$network,.,$chan,.,$vnick) off }
}
alias -l exempt {
if $isid { return $hget(idle_kick,$+($network,.,$chan,.Exempt)) }
else { .hadd -m idle_kick $+($1,.,$2,.Exempt) $3 }
}
alias -l idle {
if $isid { return $hget(idle_kick,$+($1,.,$2,.Idle)) }
else { .hadd -m idle_kick $+($1,.,$2,.Idle) $3 }
}
alias -l check_idle {
if !$2 {
var %exempt = $exempt($network,$1), %a = 1, %b = $nick($1,0,a,%exempt)
while %a <= %b {
.timer 1 %a $iif($nick($1,%a,a,%exempt).idle > $idle($network,$chan),.kick $1 $nick($1,%a,a,%exempt) No idling allowed)
inc %a
}
}
else { if ($nick($1,$2).idle > $idle($network,$chan)) { .kick $1 $2 No idling allowed } }
}
alias -l load_idle {
var %a = 1, %b = $scon(0)
while %a <= %b {
.scon %a
var %c = 1, %d = $chan(0)
while %c <= %d {
var %exempt = $exempt($network,$chan(%c)), %e = 1, %f = $nick($chan(%c),0,a,%exempt)
while %e <= %f {
$+(.timer,$network,.,$chan(%c),.,$nick($chan,%e,a,%exempt)) -m 0 500 check_idle $chan $nick($chan(%c),%e,a,%exempt)
inc %e
}
inc %c
}
inc %a
}
}
on *:quit:{
$+(.timer,$network,*,$iif($nick != $me,$nick)) off
}
on *:part:#:{
if $nick == $me { $+(.timer,$network,.,$chan,*) off }
elseif $timer($+($network,.,$chan,.,$nick)) { $+(.timer,$network,.,$chan,.,$nick) off }
}
on *:kick:#:{
if $knick == $me { $+(.timer,$network,.,$chan,*) off }
elseif $timer($+($network,.,$chan,.,$knick)) { $+(.timer,$network,.,$chan,.,$knick) off }
}
on @*:join:#:{
if !$istok($hget(idle_kick,$+($network,.,$chan,.,Exempt.Nick)),$nick,32) {
$+(.timer,$network,.,$chan,.,$nick) -m 0 500 check_idle $chan $nick
}
}