Try this:

Code:
on 500:TEXT:!ylist*:#: {
  var %a = 1
  if ($ulist(*,0) == 0) { msg $chan I have 0 results in my user list. }
  while $ulist(500,%a) {
    var %namestotal = $addtok(%namestotal,$v1,32)
    inc %a
  }
  msg $chan I have %namestotal in my user list.
}


I changed the * to 500, so it should continue to add names to the %namestotal list while there are users with a 500 access level. (When it's a * it will add users of all access levels, thus adding all the uses to the %namestotal list.)