on @*:join:#channel:{
whois $nick
}
raw 311:*:{
if (*word* iswm $6) && ($2 ison #channel) {
ban -k #channel $2 3 Bad full name
}
}
$1 is yourself, $2 is the other nickname. There is no # or $chan in raws (as far as I know), so you have to specify the channel.
Hope this helps
Regards,