Alias putkick {
if (!$isid) {
var %echo = !echo -acq $+ $iif($active == Status Window,e) info *
if ($regex(putkick,$1,/^-t(\d+)/)) tokenize 32 $2-
if ($2 == $null) %echo /putkick: insufficient parameters
elseif (!$nick($1,$me,~&@%) && o !isin $usermode) { %echo /putkick: you need to need to be at least half-opped or have ircops access }
else {
var %name = putkick. $+ $cid $+ . $+ $1
hadd -m kick %name $hget(kick,%name) $2-
if (!$timer(%name)) {
!.timer $+ %name -m 0 $iif($regml(putkick,1) isnum,$ifmatch,0) putkick.exec $cid $unsafe($1)
!.echo -q $regex(putkick,reset,/reset/)
}
}
}
}
alias putkick.exec {
var %name = putkick. $+ $1 $+ . $+ $2,%nicks $hget(kick,%name)
var %maxkick 10,%a 1,%tmp
while ($gettok(%nicks,%a,32)) {
%tmp = $addtok(%tmp,$ifmatch,44)
if ($numtok(%tmp,44) == %maxkick) {
if ($me ison $2) { kick $2 %tmp «1» }
hadd kick %name $gettok(%nicks,$calc(%a + 1) -,32)
if (!$hget(kick,%name)) {
hdel kick %name
.timer $+ %name off
}
unset %tmp
}
hdel kick %name
inc %a
}
if ($me ison $2) && (%tmp) {
kick $2 %tmp «2»
hdel kick %name
.timer $+ %name off
unset %tmp
}
}