Anyone in a channel you are in could cause you to identify. I have a similar script but I have both commands in the on connect part.
on $*:TEXT:/^[.!@]id(entify)/si:#: { if ($nick != $me) { halt } else { ns identfiy <Password> } }
I also have both commands on connect.