I cant be sure if this works since i don get any RAW 317's and im to sleepy to check why.

The blue line allows you to change howmany there are. namely change the 8.

Code:
[color:blue]alias -l topXnumber { return 8 }[/color]
;
;Designed to be run on multiple channels but only one at any one time.
;
on *:input:#:{ if ($1- == !scan) { mass.whois $chan } }
on 20:text:!scan:#:{ mass.whois $chan }
;
; $1 = $chan
alias mass.whois {
  if (!%mass.whois) {
    set $+(-u,$calc($nick($1,0) * 2 + 4)) %mass.whois $true
    .timer.mass.whois.result 1 $calc($nick($1,0) * 2 + 2) mass.whois.results $1
    var %i = $nick($1,0)
    while (%i) {
      .timer 1 $calc(%i * 2) whois $nick($1,%i) $nick($1,%i)
      dec %i
    }
    set %uptime.topX
  }
}
;
;$2 = nick
;$4 = connect time?
raw 317:*:{ set -s %uptime.topX $gettok($replace($gettok($sorttok($str($cr $+ $chr(32),$topXnumber) %uptime.top4 $+($right($+(0000000000,$calc($ctime - $4)),10),@,$2),32),$+(-,$topXnumber,-),32),$cr,$chr(32)),1-,32) }
;
; $1 = $chan
; %uptime.topX = 0000000001@nickA 0000000002@nickB 0000000003@nickC 0000000004@nickD  (maybe less than X nicks total) 
alias mass.whois.results {
  set %uptime.topX.nicks
  set %uptime.topX.times
  var %i = $numtok(%uptime.topX,32)
  while (%i) {
    set %uptime.topX.times %uptime.topX.times $calc($gettok($gettok(%uptime.topX,%i,32),1,64))
    set %uptime.topX.nicks %uptime.topX.nicks $gettok($gettok(%uptime.topX,%i,32),2,64)
    dec %i
  }
  unset %uptime.topX
  echo -s Top X uptimes on $1 are %uptime.topX.times amb un temps de $duration($calc(%uptime.topX.times))
  echo -s Top X uptime nicks on $1 are %uptime.topX.nicks
  write -c c:\stadistiques\up.txt Uptimes
  var %m = $numtok(%uptime.topX,32), %i = 1
  while (%i <= %m) {
    write c:\stadistiques\up.txt # $+ %i lloc hi ha $gettok(%uptime.topX.nicks,%i,32) amb un temps de $duration($calc($gettok(%uptime.topX.times,%i,32)))
    inc %i
  }
  play #la_penya_del_pollastre c:\stadistiques\up.txt 500
  ; ^ do what you well here
}