Here's what I use:
Code:

alias deopme {
  if ($1 == -a) {
    var %activecid = $activecid
    var %active = $iif($numtok($active,32) > 1,$+(",$active,"),$active)
    var %n = 1
    while ($scon(%n)) {
      scon %n
      var %s, %c = 1
      while ($chan(%c)) {
        if ($me isop $ifmatch) {
          if ($len(%s) > 0) %s = $+(%s,$crlf,MODE $chan(%c) -o $me)
          else %s = MODE $chan(%c) -o $me
        }
        inc %c
      }
      .raw %s
      inc %n
    }
    scid %activecid
    window -a %active
  }
  elseif ($1 == -n) {
    var %s, %c = 1
    while ($chan(%c)) {
      if ($me isop $ifmatch) {
        if ($len(%s) > 0) %s = $+(%s,$crlf,MODE $chan(%c) -o $me)
        else %s = MODE $chan(%c) -o $me
      }
      inc %c
    }
    .raw %s
  }
  elseif ($me isop #$1) .raw MODE #$1 -o $me
  elseif (!$1) && (((#* iswm $active) && ($me isop $active))) .raw MODE $active -o $me
  elseif (($1 == ?) || ((!$1) && (#* !iswm $active))) {
    linesep -a
    echo $color(info) -ati2 * /DEOPME [-a|-n|[#]channel]
    echo $color(info) -ati2 * Deops you on channels where you are opped
    linesep -a
    echo $color(info2) -ati2 /deopme -a     -a(ll) deops you in all channels on all networks
    echo $color(info2) -ati2 /deopme -n     -n(etwork) deops you in all channels on the current network
    echo $color(info2) -ati2 /deopme #mIRC  deops you in #mIRC on this network only
    echo $color(info2) -ati2 /deopme mIRC   deops you in #mIRC on this network only
    echo $color(info2) -ati2 /deopme ?      brings up this help info
    echo $color(info2) -ati2 /deopme        - in a channel window, deops you
    echo $color(info2) -ati2                - in a non-channel window, brings up this help info
    linesep -a
  }
}

I hope you find this useful, both as an exercise in scripting for multiple networks and for general scripting. cool