on *:text:*:#:{
if ($1 == !stats) || ($1 == @stats) {
set %stats.chan $chan | set %stats.nick $nick | set %stats.msg $iif($left($1,1) == @,msg $chan,notice $nick)
if ($2 == -s) { writeini namedb.ini RS-Names $address($nick,3) $replace($3-,$chr(32),+) | %stats.msg Name Stored Successfully. | unset %stats.* | halt }
if ($2- != -s) { set %stats.rsn $replace($2-,$chr(32),+) }
if ($2- == $null) { set %stats.rsn $readini($scriptdirnamedb.ini,RS-Names,$address($nick,3)) }
if (%stats.rsn == $null) { notice $nick Please either specify an rs name or store yours via $1 -s rs-name | unset %stats.* | halt }
if ($sock(stats).status != $null) { notice $nick Stats Script is in use. Try again.... now! | unset %stats.* | halt }
if ($len(%stats.name) > 12) { notice $nick Error: name too long. | unset %stats.* | halt }
sockopen stats vulcan.runeweb.net 80
;msg color 1;
set %stats.color1 $+($chr(3),14)
;msg color 2;
set %stats.color2 $+($chr(3),04)
}
}
on *:sockopen:stats:{
sockwrite -nt $sockname GET /v3/stats.genie?rsname= $+ %stats.rsn HTTP/1.0
sockwrite -nt $sockname User-Agent: Armadyl and Genie FTW
sockwrite -nt $sockname Host: vulcan.runeweb.net $+ $crlf $+ $crlf
}
on *:sockread:stats:{
if ($sockerr > 0) { .notice %stats.nick Error: Try again later. | unset %stats.* | halt }
var %stats.read | sockread %stats.read
if (<b>Personal isin %stats.read) { set %stats.name $remove(%stats.read,Personal $+ $chr(32),Scores $+ $chr(32),For $+ $chr(32),<b>,</b>) | set %stats.text $remove(%stats.read,<b>,</b>) | set %stats.text $left(%stats.text,- $+ $len(%stats.name)) }
tokenize 124 $remove(%stats.read,Genie:)
if ($0 == 4) { %stats.printline1 = %stats.printline1 $+(%stats.color1,$1,:,%stats.color2,$chr(32),$3) }
}
on *:sockclose:stats:{
if (%stats.printline1 != $null) { %stats.msg %stats.color1 $+ %stats.text $+ %stats.color2 %stats.name | %stats.msg %stats.printline1 }
if (%stats.printline1 == $null) { %stats.msg This Person does not appear on the hiscores. }
unset %stats.*
}