Firstly, this is stupid - it could be used a lil useful only as a spybot, but thats stupid too. Second - the first 20 nicks showing is pretty stupid too - if you don`t know how to view all of them, use $nick($chan,0) instead of 20.
I would make it like this:
alias channicks {
.var %nicks = $nick($chan,0)
.var %nick = 0
while (%nicks > %nick) {
.inc %nick
.var %nownick = $nickstatus($nick($chan,%nick),$chan)
.return %nownick
}
alias nickstatus {
if ($1 isop $2) { .return @ $+ $1 }
if ($1 ishop $2) { .return % $+ $1 }
if ($1 isvop $2) { .return + $+ $1 }
else { .return $1 }
}