Try to use the code tags when posting code - click on the hash symbol (#) immediately above the editbox on the posting form.

Code:
  if ($did == 8) {
    did -r $dname 11
    var %i = 1
    while ($hget(TwitchChannelUsers,%i).data) {
      if ($v1 >= 4) { did -a $dname 11 $hget(TwitchChannelUsers,%i).item }
      inc %i
    }
  }