Code:
on *:op:#:{
if $opnick == $me {
check.badnicks $chan
}
}
on *:serverop:#:{
if $opnick == $me {
check.badnicks $chan
}
}
alias check.badnicks {
var %a = 1
while %a <= $nick($1,0) {
if badnick isin $level($nick($1,%a)) {
.ban -ku300 $1 $nick($1,%a) 4
dec %a
}
inc %a
}
}
 


This will check the nicks that are already on the channel when you are opped, rather than when you join, since you don't have kick/ban privileges until you are opped. A lot of networks will op you very quickly after joining, but there is a little bit of a delay.