This is how I would have made it, without 2 vars.
alias masscount { if ($chan(0)) { var %x = $chan(0) while (%x) { echo -a COUNT $chan(%x) has $nick($chan(%x),0) users. dec %x } } }