There's certainly no need to be checking $nick everytime something is said. I think the better method here would be to combine hixxy and SladeKraven's codes.
on @*:JOIN:[color:red]#YourChannel[/color]:{
mode $chan +v $nick
}
alias voiceall {
if ($me !isop $1) {
echo -a Error: You are not opped on $1
}
else {
var %i = 1, %l = $nick($1,0)
while (%i <= %l) {
if ($nick($1,%i) !isvo $1) {
mode $1 +v $nick($1,%i)
}
inc %i
}
}
}
menu nicklist {
Voice All:voiceall
}
This voices all users on join.
It also puts an item in your nick list menu for voicing everyone. Simply click on it and it will voice any unvoiced nicks in the channel.
It makes more sense to do it this way then scan the entire nicklist everytime someone joins.