on *:DICONNECT:{ unset $+(%,wait:,$cid,:*) }
on @*:JOIN:#:{
set $nwait($chan).noop $nwait($chan) $nick
$+(.timerWait:,$cid,:,$chan) 1 5 nWaitAdminMsg $chan
}
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) !isreg #) %n = $gettok(%n,2-,32)
mode # +v $gettok(%n,1,32)
set $nwait(#).noop $gettok(%n,2-,32)
}
alias nWait {
if ($prop == noop) { return $($+(%,wait:,$cid,:,$1),2) }
return $+(%,wait:,$cid,:,$1)
}
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)) { %a = $addtok(%a,$v1,44) | inc %x }
if (%a) {
msg %a The following users are waiting for help: %r
}
}
}
}