i want to limit the invite and joining to channel ops only ....

so I thought about using this:

Code:
 on *:INVITE:#:{
  if $nick isop $chan /join $chan
  else msg $nick you must be a channel operator on $chan to invite me
}

 


What am i missing to make this work??