Hello! So I’m Trying to make a custom leaderboard, but I don’t know how to order the scores from Highest to Lowest.
I’m using a map to store every player score.
var LBOrderMap : [player]int = map{}
So now I have a list of ints with the key being the player and I would want to know how to order those ints from highest to lowest!
Thank you in advance!
I am not sure if array sort would work on a map
here’s the loop we use to update our leaderboard
the player scores are ordered highest to lowest in the playerstandings array
CheckPlayerScores()<suspends>:void=
loop:
Players:=GetPlayspace().GetPlayers()
for(i : int = 0..Players.Length):
if(Player : agent = Players[i]):
if(Agent : agent =agent[Player]):
set CurrentScore = 0
set CurrentScore += ScoreManagerDevice.GetCurrentScore(Agent)
if(CurrentScore >= PlayerScores[i]):
if(set PlayerScores[i] = CurrentScore){}
if(CurrentScore > HighScore):
set HighScore = CurrentScore
set PlayerStandings = Sort(PlayerScores, false, CompareInts)
UpdateLeaderBoard()
Sleep(0.5)
1 Like