All pastes #269887 Raw Edit

All Stats Checker

public text v1 · immutable
·published 2006-12-06 22:01 UTC
rendered paste body
on *:TEXT:!all*:#:{  
if ($len($2-) > 12) { notice $nick 3 Nicks can only have 12 characters or less }
else {   
set %nick $nick  
  set %statsuser 3 Nick 4 $upper($left($2-,1)) $+ $right($2-,-1-) 3 
  set %user $2-
  sockopen all parsers.o-ss.net 80
}
}

on *:sockopen:all:{ 
  sockwrite -n $sockname GET $+(/stats.php?user=,%user) HTTP/1.0 

  sockwrite -n $sockname Host: parsers.o-ss.net $+ $crlf $+ $crlf
}

on *:sockread:all:{  
  if ($sockerr > 0) return
  :nextread
  sockread %temp
  if ($sockbr == 0) return
  if (%temp == $null) %temp = -       
  write stats.txt %temp
  goto nextread              
}

on *:sockclose:all:{  
if (*not feature in the hiscores* iswm $read(stats.txt,8)) { 
notice %nick %statsuser Does Not Feature In The High Scores. 
unset %stats
  unset %nick
  unset %statsuser  
sockclose all  
remove stats.txt
}
else { 
set %stats %statsuser
  var %line = 9
  while (%line <= 31) {
    set %stats $addtok(%stats,3 $gettok($read(stats.txt,%line),1,32) 4 $replace($gettok($read(stats.txt,%line),3,32),Ranked,NR),32)
    inc %line
  }
  notice %nick %stats
  unset %stats
  unset %nick
  unset %statsuser  
sockclose all  
remove stats.txt
}
}