My bot is programmed with the ability to protect itself from bannings as well as users in it's userlist with level protect. The script works, for the most part, except for the fact that the bot seems to be registering protected users as itself and doing a /msg chanserv unban $chan instead of a /mode $chan -b $banmask. Any ideas on what's up?

Here's the full address of myself and the friend I was testing user protection on:

Me:

Code:
Mpot is ~Mpot@adsl-065-007-137-149.sip.asm.bellsouth.net * Mpot


Friend:

Code:
J711 is jbarron711@adsl-68-75-52-26.dsl.emhril.ameritech.net * J711


Script:

Code:
on *:BAN:#:{
  if (%selfprotect == on && $banmask == $address($me,1) || $address($me,2) || $address($me,3) || $address($me,4) || $address($me,5) || $address($me,6) || $address($me,7) || $address($me,8) || $address($me,9)) { /msg chanserv unban $chan }
  elseif (%userprotect == on && protect isin $level($mask($banmask,1)) || $level($mask($banmask,2)) || $level($mask($banmask,3)) || $level($mask($banmask,4)) || $level($mask($banmask,5)) || $level($mask($banmask,6)) || $level($mask($banmask,7)) || $level($mask($banmask,8)) || $level($mask($banmask,9))) { /mode $chan -b $banmask }
}