Solved sorting list for a leaderboard

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Ubya

Member
Jun 15, 2020
10
0
1
27
i checked the forum, i think my best option is this code
Code:
command /ranking:
    trigger:
        loop {Kills::*}:
            add 1 to {_size}
            if {_low.to.high.list::%loop-value%} is not set:
                set {_low.to.high.list::%loop-value%} to loop-index
            else:
                set {_n} to 0
                loop {_size} times:
                    set {_n} to {_n}+1
                    {_low.to.high.list::%loop-value-1%.%{_n}%} is not set
                    set {_low.to.high.list::%loop-value-1%.%{_n}%} to loop-index
                    stop loop
        wait 1 tick
        set {_n} to size of {_low.to.high.list::*}
        loop {_low.to.high.list::*}:
            set {_high.to.low.list::%{_n}%} to loop-value
            set {_n} to {_n}-1
        wait 1 tick
        set {_i} to 0
#THIS IS THE MESSAGE WITH TOP KILLS
        send "&7&m-----------&8< &6Top10 &8>&7&m-----------"
        loop {_high.to.low.list::*}:
            add 1 to {_topnumber}
            set {_player} to "%loop-value%" parsed as offlineplayer
            send "&7%{_topnumber}% - &c%{_player}% &8» &7%{Kills::%loop-value%}% Kills"
            add 1 to {_i}
            if {_topnumber} > 10: #this is top 10 you can change it
                stop
        send "&7&m------------------------------"

but i can't decipher it exactly.
what data is kept in {kills::*}?
i'm making a simple game, every time a player wins he gains one point, and he appears on a leaderboard, or at least this is what i want to do.
what do i add to {kills::*}? another variable named {%player%.win} that stores the number of wins?

i didn't think it would be that hard, could someone give me a hand figuring this out?
 
Your variable should be inside the list so when you add a win to a player you add it to {kills::%player%}
 
Status
Not open for further replies.