use, if ($nick isop $chan) and try setting $3 to a variable.