you need to double evaluate the variable. Here's a re-write of your code that will make it a bit better.
Code:
on *:text:*:#:{
  if $nick isop $chan {
    set $+(%,$network,.,$chan) $iif($1 == !off,$false,$iif($1 == !on,$true))
  }
  elseif $($+(%,$network,.,$chan),2) && $me isop $chan {
    ban -ku1800 $chan $nick 3 banned
  }
}


This will track whether the setting on the channel is on or off, and is multi-network ready.
Please note: that the way this is done, if the variable is on, then only ops can say anything in the channel without being banned.

In both your original code, and Bekar's reply, if the !off or !on commands were sent to the bot via pm (perfectly valid with the * wildcard for the location), then you will get an error when the script tries to check if the nick is an op on the channel, as $chan will return $null under those circumstances.

Last edited by RusselB; 22/10/07 05:23 AM.