Yeah adding what Horstl stated, you should use $comchan so it works for all the channels rather than a single channel, which has to be specified:
Code:
on *:nick: {
if (M3GA?* iswm $newnick) {
var %x = $comchan($newnick,0)
while (%x) {
if (($me isop $comchan($newnick,%x)) && ($newnick ison $v2)) {
kick $v2 $v1 Message
}
dec %x
}
}
}