on *:deop:#:{if ($opnick == $me) { chanserv op $chan $opnick } }
on *:ban:#:{ if ($banmask iswm $address($me,5)) { cs unban # }
Also, most clients have an option to rejoin a channel when kicked, I'm guess you are on mIRC so just go to options/IRC/check the box that says 'rejoin channels when kicked'