You can't have events inside events. Something like this
Code:
on !*:join:#chan:{
set -u99 $+(%,$cid,whois.,$nick) $chan
whois $nick
}
raw NNN:*:{
if $($+(%,$cid,whois.,$2),2) { echo -itc whois $ifmatch blahblah }
else echo -sitc whois blahblah
halt
}
raw 318:*:{
unset $+(%,$cid,whois.,$2)
halt
}