the ' ! ' before the 'ison' operator makes the operator 'isNOTon'.

I would use the
Code:
on *:text:*:#channel: {
  if (X ison $chan) { return }
  else { commands}

return is like /halt. it just exits the script.