Any of the examples should work based on the information you gave, but here's another example:
on *:TEXT:!off:*: {
if ($nick isop $chan) {
set % $+ $chan off
}
}
on *:TEXT:!on:*: {
if ($nick isop $chan) {
unset % $+ $chan
}
}
on *:TEXT:*example*:#: {
if ($nick !isop $chan && $($+(%,$chan),2) != off) {
ban -ku1800 $chan $nick 3 banned!
}
}
If these aren't doing what you want, then you need to be more specific as to what you're trying to accomplish because they do what your example was trying to do.