Are you sure you meant $friends? Do you have a friends alias that will return the names? I think you may have meant a var like %friends. Just a thought.
Edit: That script is not a good idea. The on notice event doesnt even check if the nickname was nickserv, meaning it would be triggered by any notice. I dont think that's what you want. Probably something more like:
on *:join:#chan: {
if ($nick !isin %friends) {
msg nickserv status $nick
set %nss $nick $chan
}
}
on *:notice:*Status*:?: {
if ($nick == nickserv) && ($2 == $gettok(%nss,1,32)) && ($3 != 3) {
kick $gettok(%nss,2,32) $gettok(%nss,1,32) Bye
unset %nss
}
}
Then if you havent already done so,
/set %friends friend1 friend2 friend3
Hope this helps