on *:DICONNECT: unset $+(%,wait:,$cid,:*)
on @*:JOIN:#:{
set $nwait($chan).noop $nwait($chan) $nick
$+(.timerWait:,$cid,:,$chan) 1 5 nWaitAdminMsg $!( $chan ,0)
}
on !*:NICK:{
var %x = 1, %c, %n = /(?<=^| )\Q $+ $replacecs($nick,\E,\E\\E\Q) $+ \E(?= |$)/
while ($comchan($nick,%x)) {
%c = $v1
set $nwait(%c).noop $regsubex($nwait(%c),%n,$newnick)
inc %x
}
}
on @*:TEXT:!next:#:{
var %n = $nwait(#)
while ($gettok(%n,1,32) && $v1 !isreg #) %n = $gettok(%n,2-,32)
if (%n) {
mode # +v $gettok(%n,1,32)
set $nwait(#).noop $gettok(%n,2-,32)
}
else unset $nwait(#).noop
}
alias nWait {
if ($prop == noop) return $+(%,wait:,$cid,:,$1)
return $($+(%,wait:,$cid,:,$1),2)
}
alias nWaitAdminMsg {
if ($me !isop $1) unset $nwait($1).noop
else {
var %n = $nwait($1), %r, %x = 1
while ($gettok(%n,%x,32)) {
if ($v1 ison $1) %r = %r $v1
inc %x
}
if (!%r) unset $nwait($1).noop
else {
set $nwait($1).noop %r
var %x = 1, %a
while ($ulist(*,admin,%x)) {
var %u = $v1, %y = 1
while ($ialchan(%u,$1,%y)) {
%a = $addtok(%a,$v1,44)
inc %y
}
inc %x
}
if (%a) msg %a The following users are waiting for help: %r
}
}
}