It's because there is a conflict. Serves me right for testing it on a server that doesn't check for ident.

The "~" is not classed as an alphanumeric character so the script cannot check for isalpha and the ~ at the same time. I suggest the following change:
Code:
if ($chr(126) isin $3) && ($islower($3)) && ($remove($3,$chr(126)) isalpha) && ($len($3) > 8) {
  ctcp $6 PING
  echo -s 12 $6 has this userid:4 $3
}
I changed ($3 isalpha) to ($remove($3,$chr(126)). This excludes the ~ when checking for alpha characters.