msg $comchan($2,%z) $2 is being banned for being on %chantest

This line is telling each channel you share with the bad person that they're being banned in %chantest - but only later checks if you are op in the other channel.

If you only want to ban them in 1 channel - then don't have the loop that checks to see all the $comchan's you share. I'm guessing none of your other ops share channels with the bad people?

Easies quick fix is to put the msg inside the loop that acts only when you're an op:


while (%z) {
if ($me isop $comchan($2,%z)) {
msg $comchan($2,%z) $2 is being banned for being on %chantest
ban -ku3600 $comchan($2,%z) $2 11
}