Well, your logic is right but you don't actually use the word
then
on @1:DEOP:#:{
if ($remove($address($opnick,1),$chr(42),$chr(33)) == ident@hostmask.com) {
mode # +o $opnick
if ($nick ison #) {
mode # -o $nick
}
}
}
Though, I think your best bet is to make use of the userlist, especially if there are many [email]ident@hostmasks[/email] to check for.