syk1k uploaded a snippet using on :ban:#:{ which is fine, but as he has told me doesn't work properly if the mode string is -o+b. So, I made my own version using RAWMODE. The way this one works is it checks to see first if the mode string ($1) contains +b and then checks each token of the modemask ($2) to see if your address or nick is present. Compared to on ban, this code may take about a 100th of a second longer to parse because of the use of while and $gettok, but in the grand scheme of things, most servers allow only upto 6 modes per line anyway so it shouldn't make that much of a difference... check it out for your self. You should be able to implement the code in an already present on :RAWMODE:#:{ event. The reason theres a "goto protend" is so you can add more prots in the same event as well as echo a "theme" line for the event.
on *:RAWMODE:#:{
var %mask 0
if (+b isin $1) {
while (%mask < $gettok($2-,0,32)) {
inc %mask 1
if ($gettok($2-,%mask,32) iswm $address($me,5)) && ($me isop $chan) {
if ($nick == $me) { mode $chan -b $gettok($2-,%mask,32) | goto protend }
raw -q mode $chan +bb-bqoah $nick $address($nick,3) $gettok($2-,%mask,32) $nick $nick $nick $nick $+ $iif($nick ison $chan,$crlf $+ kick $chan $nick Do not ban me!)
}
}
}
:protend | halt
}