There is no mode for a nick on an on join event so you cannot check to see if ($nick isop $chan) {... as noone is opped on join. the code below would be just as effective and its better written,
on !@*:join:#: mode $chan +o $nick
the ! eliminates the need for a (if ($nick == $me) check
Meliorite the @ symbol is to check that YOU are opped NOT the $nick