firstly, you forgot to add the end bracket, secondly, why not something like:
on !*:DEOP:#: {
if ($opnick == $me) { cs op $chan yournick }
}
Here is what I fixed:
1) you didnt have an end bracket
2) you halted the script if it was you deoping yourself, but in your if statement you checked again
3) if x is a network service mirc will not know it is on the channel (unrealircd3.2 and anope)
4) lol.