on me:*:join:#:{
updatenl
var %i = 1
while $nick($chan,%i,o) {
.protect $nick(#,%i,o) $chan 2 $network
inc %i
}
}
If you don't want the protection to be channel specific, remove the $chan from protect line, also, if you don't want it to be network specific, remove the $network from that same line.