Here are two commented scriptas to get you started.

Code:
; Deop Protections
; --
; change red portion tot he channel of your choice, or leave
; as is for all channels
on *:DEOP:[color:Red]#[/color]: {
  ; check if it was us being deopped, and not use deopping ourself
  if (($opnick == $me) && ($nick != $me)) {
    ; send chanserv our deop notice
    /msg chanserv deop $chan $nick
    ; op ourself
    /msg chanserv op $chan $me
    ; Remvoe the ; before this line if you wish to kick them
    ; /kick $chan $nick Don't Deop Me
  }
}

; Ban protection
; --
; Again, change red portion to channel you wish to tend to, or
; leave as is for all channels
; (the @ prefix means "only when im opped")
on @*:BAN:[color:Red]#[/color]: {
  ; make it easier to view what is transpiring
  var %ban = $banmask        | ; The banned mask
  var %us = $address($me, 5) | ; Our mask
  ; check if we were banned
  if ((%ban iswm %us) || ($bnick == $me)) {
    ; unban ourself first, as well as deop them
    /mode $chan -b+o $banmask $nick
    ; remove the ; before this line to kick them (likewise for the ban)
    ; /kick $chan $nick Don't Ban Me
    ; /mode $chan +bb $nick $address($nick, 11)
  }
}