1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved sorting list for a leaderboard

Discussion in 'Skript' started by Ubya, Jul 3, 2020.

Thread Status:
Not open for further replies.
  1. Ubya

    Ubya Member

    Joined:
    Jun 15, 2020
    Messages:
    10
    Likes Received:
    0
    i checked the forum, i think my best option is this code
    Code (Text):
    1. command /ranking:
    2.     trigger:
    3.         loop {Kills::*}:
    4.             add 1 to {_size}
    5.             if {_low.to.high.list::%loop-value%} is not set:
    6.                 set {_low.to.high.list::%loop-value%} to loop-index
    7.             else:
    8.                 set {_n} to 0
    9.                 loop {_size} times:
    10.                     set {_n} to {_n}+1
    11.                     {_low.to.high.list::%loop-value-1%.%{_n}%} is not set
    12.                     set {_low.to.high.list::%loop-value-1%.%{_n}%} to loop-index
    13.                     stop loop
    14.         wait 1 tick
    15.         set {_n} to size of {_low.to.high.list::*}
    16.         loop {_low.to.high.list::*}:
    17.             set {_high.to.low.list::%{_n}%} to loop-value
    18.             set {_n} to {_n}-1
    19.         wait 1 tick
    20.         set {_i} to 0
    21. #THIS IS THE MESSAGE WITH TOP KILLS
    22.         send "&7&m-----------&8< &6Top10 &8>&7&m-----------"
    23.         loop {_high.to.low.list::*}:
    24.             add 1 to {_topnumber}
    25.             set {_player} to "%loop-value%" parsed as offlineplayer
    26.             send "&7%{_topnumber}% - &c%{_player}% &8» &7%{Kills::%loop-value%}% Kills"
    27.             add 1 to {_i}
    28.             if {_topnumber} > 10: #this is top 10 you can change it
    29.                 stop
    30.         send "&7&m------------------------------"
    31.  
    32.    
    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?
     
  2. Juffix

    Juffix Member

    Joined:
    Apr 7, 2019
    Messages:
    19
    Likes Received:
    4
    Your variable should be inside the list so when you add a win to a player you add it to {kills::%player%}
     
    • Agree Agree x 1
  3. Ubya

    Ubya Member

    Joined:
    Jun 15, 2020
    Messages:
    10
    Likes Received:
    0
    ooohhh ok i'll try that
     
Thread Status:
Not open for further replies.

Share This Page

Loading...