How would I show the top 5 players in the BYOND hub, like when they click on my game it shows it in the little space by connect
Scoreboard Code:
// Do not modify this code unless you know what your doing.
#define DEBUG
/var/const/
scoreboard={""}
scoreboardtitle={"<STYLE>BODY {background: black; color: white}</STYLE><head><title>Scoreboard</title></head></body>"}
/Rank_Entry/
var{Name;Key;Level;Date}
New(mob/person)
if(!person)return
Name=(person.name)
Key=(person.key)
Level=(person.Level)
Date=(time2text(world.realtime))
/proc/
RankingDisplay(var/mob/person)
var/list/Levels=new()
var/savefile/F=new("Levels.sav")
F[("stuff")]>>(Levels)
var/html="<center><TABLE BORDER=1><TR><TH><html><BODY><center><h1><U><font color=red>Scoreboard<font color=white></u></h1><TABLE CELLSPACING=10>"
if(!Levels)html+="<TR><TD>No high rankings to display.</TD></TR>\n"
else
html+="<tr><th><B>#</th><th>Name <I>(key)</I></th><th>Level</th><th>Date</th></tr>\n<br>"
for(var/number in 1 to Levels.len)
var{character=(Levels[(number)]);Rank_Entry/player=(Levels[(character)])}
html+="<tr><td><u>[(number)]\th</td><td></u>[(player.Name)] <I>([(player.Key)])</I></td><td>[num2text(round(player.Level),100)]</td><td>[(player.Date)]</td></tr>\n"
person<<browse("[scoreboardtitle][html]","window=scoreboard;size=524x344")
Ranking(var/mob/player)
if(!player||!player.client)return
var/savefile/F=new("Levels.sav")
var/list/Level=new()
F[("stuff")]>>(Level)
if(!Level)Level=new()
var{character="[(player.client.ckey)]/[(player.name)]"
score=Level.Find(character)
Rank_Entry/newest=new(player)
Rank_Entry/last}
if(score)
var/Rank_Entry/old=(Level[(character)])
if(old.Level>=player.Level)return score
while(score>1)
last=Level[(Level[(score-1)])]
if(last.Level>=player.Level)break
Level[(score)]=(Level[(score-1)])
Level[(--score)]=(character)
Level[(Level[(score+1)])]=(last)
Level[(character)]=(newest)
F[("stuff")]<<(Level)
return score
score=(Level.len)
if(score>=10)
last=(Level[(Level[(score)])])
if(last.Level>=player.Level)return 11
Level[(score)]=(character)
else score=(Level.len+1),Level+=(character)
while(score>1)
last=(Level[(Level[(score-1)])])
if(last.Level>=player.Level)break
Level[(score)]=(Level[(score-1)])
Level[(--score)]=(character)
Level[(Level[(score+1)])]=(last)
Level[(character)]=(newest)
F[("stuff")]<<(Level)
return score