This script is designed to be used remotely (ie: using another client) or directly (using the client that is running the script)

The ON TEXT event is for remote access, and the ON INPUT event is for direct access. The format for the commands is the same no matter which access is being used.
Code:
on *:input:*:{
  if $1 == !addchan {    chan add $strip($2-)  }
  elseif $1 == !remchan {    chan rem $strip($2-)  }
}
on *:text:!*:*:{
  if $istok($($+(%,op.,$network,.,$chan),2),$nick,32) {
    if $1 == !addchan {    chan add $strip($2-)  }
    elseif $1 == !remchan {    chan rem $strip($2-)  }
  }
}
on *:start:{
  if !$hget(badchan) { .hmake badchan 100 }
  if $exists($scriptdirbadchan.hsh) { .hload badchan $scriptdirbadchan.hsh }
  .scon -at1 checkops
}
on *:exit:{
  .hsave badchan $scriptdirbadchan.hsh
}
on *:disconnect:{
  .hsave badchan $scriptdirbadchan.hsh
}
alias -l checkops {
  var %b = $chan(0)
  while %b {
    var %c = $nick($chan(%b),0,oh)
    while %c {
      set $+(%,ohnotice,$network,.,$chan) $addtok($($+(%,ohnotice,$network,.,$chan),2),$nick($chan(%b),%c,oh),44)
      dec %c
    }
    dec %b
  }
}
alias chan {
  if $1 == add {
    if !$2 {
      .msg $nick Usage !addchan #channel_1,#channel_2,#channel_3 Message
      .msg $nick Multiple channels can be specified by comma separating them.
      .msg $nick A common message regarding all specified channels can be entered by separating the message from the channels with a space.
    }
    else {
      var %a = $numtok($2,44)
      while %a {
        .hadd -m Badchan $gettok($2,%a,44) $iif($3,$3-,Bad Channel)
        dec %a
      }
      .msg $nick Bad channels $2 have been added with the message of $iif($3,$3-,Bad Channel)
    }
  }
  elseif $1 == rem {
    if !$2 {
      .msg $nick Usage !remchan #channel_1,#channel_2,#channel_3
      .msg $nick Multiple channels can be specified by comma separating them.
    }
    else {
      var %a = $numtok($2,44)
      while %a {
        .hdel Badchan $gettok($2,%a,44)
        dec %a
      }
      .msg $nick Bad channels $2 have been removed.
    }
  }
}
on *:join:#:{
  var %ohchan = $chan
  .enable #ohnotice
  .whois $nick
}
#ohnotice off
raw 318:*:{
  .disable #ohnotice
  haltdef
}
raw 319:*:{
  var %a = $numtok($3-,32)
  while $hget(Badchan,$gettok($3-,%a,32)) {
    .notice $($+(%,ohnotice,$network,.,%ohchan),2) $2 is also on $gettok($3-,%a,32) with a warning message of $hget(Badchan,$gettok($3-,%a,32))
    dec %a
  }
  haltdef
}
#ohnotice end
on *:op:#:{
  set $+(%,ohnotice,$network,.,$chan) $addtok($($+(%,ohnotice,$network,.,$chan),2),$opnick,44)
}
on *:help:#:{
  set $+(%,ohnotice,$network,.,$chan) $addtok($($+(%,ohnotice,$network,.,$chan),2),$hnick,44)
}
on *:deop:#:{
  set $+(%,ohnotice,$network,.,$chan) $remtok($($+(%,ohnotice,$network,.,$chan),2),$opnick,1,44)
}
on *:dehelp:#:{
  set $+(%,ohnotice,$network,.,$chan) $remtok($($+(%,ohnotice,$network,.,$chan),2),$hnick,1,44)
}
on *:quit:{
  set $+(%,ohnotice,$network,.,$chan) $remtok($($+(%,ohnotice,$network,.,$chan),2),$nick,1,44)
}
on *:part:#:{
  set $+(%,ohnotice,$network,.,$chan) $remtok($($+(%,ohnotice,$network,.,$chan),2),$nick,1,44)
}
on *:kick:#:{
  set $+(%,ohnotice,$network,.,$chan) $remtok($($+(%,ohnotice,$network,.,$chan),2),$knick,1,44)
}