I prefer the use of a hash table for this sort of operation:
on *:START:bn
on *:CONNECT:bn
on *:EXIT:hsave b b.hsh
alias -l bn {
if (!$hget(b)) { hmake b 100 }
if ($isfile($qt($scriptdirb.hsh))) { hload b $qt($scriptdirb.hsh) }
}
on $*:TEXT:/!(\w+)\s(\S+)/iS:#: {
if ($regml(1) = bnick) {
hadd -m b n $addtok($hget(b,n),$regml(2),32) | .msg # 4,1 $+ $regml(2) added to the hash file!
}
elseif ($regml(1) = nick) && (!$istok($hget(b,n),$regml(2),32)) {
.msg # 4,1Failed Attempt By $nick With $1 Reason: Inappropriate nick Failed Nick ( $regml(2) )
}
else { msg # 4,1 $+ Authorized nick changing nick to: $regml(2) | nick $regml(2) }
}