You can replace your if statement with an easy:
if (*`ownz iswm $nick) { }
If you wanted to op everyone that doesn't have an op, but is a regular or voiced user, that has those tags at the end of the nick, with an alias. You could do something like this:
alias opallownz {
var %c = $iif($1,$1,$active) , %i = 1
if ($me isop %c) {
while ($nick(%c,%i)) {
var %n = $v1
if (*`ownz iswm %n && (%n isreg %c || %n isvoice %c)) {
.timer 1 $calc(%i * 3) mode %c +o %n
}
inc %i
}
}
}
As schaefer mentioned, this will op a person if they use just the nick "`ownz".
If you wish to prevent this, you can change the if statement to this:
if (*?`ownz iswm %n && (%n isreg %c || %n isvoice %c)) {
Note: This works in two ways, you type: /opallownz, in your active channel, or you type: /opallownz #channelname.