Exact same script, but shorter:
Code:
; This will deop me on every channel if I am op. 
; Syntax: /deopme
alias deopme { 
  var %x = $chan(0) 
  while (%x) { 
    if ($me isop $chan(%x)) mode $v2 -o $me
    dec %x 
  }  
}
; This will op me on every channel if I am not op.
; Syntax: /opme
alias opme { 
  var %x = $chan(0) 
  while (%x) { 
    if ($me !isop $chan(%x)) msg ChanServ op $v2 $me
    dec %x 
  }
}