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 How to make a top list?

Discussion in 'Skript' started by senge1337, Mar 13, 2020.

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

    senge1337 Member

    Joined:
    Sep 21, 2019
    Messages:
    19
    Likes Received:
    0
    Hi,
    I have a problem.
    I have a variable {cookieclicker::%player's uuid%::emoji_stuck_out_tongue:oints}.
    How would I make a top GUI list with it?
    I mean like:
    Code (Text):
    1. open virtual chest inventory with size 6 named "&b&lTOP" to player
    2. format gui slot 0 of player with 1 of skull of ("senge1337" parsed as offlineplayer) named "&61. senge1337" with lore "&63 cookies."
    There is code online to do it, but it's just with {cookieclicker::%player%::emoji_stuck_out_tongue:oints} and im using UUID's

    Example of that code:
    Code (Text):
    1.  
    2. command /test:
    3.     trigger:
    4.         set {_s} to size of {cookieclicker::*::points}
    5.         loop {cookieclicker::*::points}:
    6.             set {_list::%loop-index%} to loop-value
    7.         loop {_s} times:
    8.             loop {_list::*}:
    9.                 if {_v.%loop-number%} is not set:
    10.                     set {_v.%loop-number%} to loop-value-2
    11.                     set {_n.%loop-number%} to loop-index
    12.                 if loop-value-2 is larger than {_v.%loop-number%}:
    13.                     set {_v.%loop-number%} to loop-value-2
    14.                     set {_n.%loop-number%} to loop-index
    15.             remove {_v.%loop-number%} from {_list::*}
    16.         loop {_s} times:
    17.             if loop-number is smaller than or equal to 5:
    18.                 send "%loop-number%. %{_n.%loop-number%}% -> %{_v.%loop-number%}%"
    19.  
    I know this is not a GUI, but i could change this.

    Anyone know how to solve this issue? The code above would probably just give me 1. [MyUuid] instead of 1. senge1337.
    Thanks,
    senge1337.
     
  2. Best Answer:
    Post #2 by AsuDev, Mar 13, 2020
  3. AsuDev

    VIP

    Joined:
    Jan 27, 2017
    Messages:
    243
    Likes Received:
    21
    Parse the uuid as an offline player if you want it to display their name instead of uuid.
     
  4. Runakai

    Moderator Supporter

    Joined:
    Apr 27, 2018
    Messages:
    497
    Likes Received:
    31
    Better sorting expression, works fine with any number and ignores other types:
    Usage: (1¦(highest|top)|2¦(lowest|last)) %integer% values of %objects% (with format|formatted) %string%

    https://sourceb.in/94c37bd0ab

    Credit to EWS
     
  5. AsuDev

    VIP

    Joined:
    Jan 27, 2017
    Messages:
    243
    Likes Received:
    21
    That code you sent uses TreeSet. TreeSet is a bad idea because it doesn't allow duplicates. If two players have the same value, only one will be counted. This is pretty bad for a leaderboard.
     
  6. senge1337

    senge1337 Member

    Joined:
    Sep 21, 2019
    Messages:
    19
    Likes Received:
    0
Thread Status:
Not open for further replies.

Share This Page

Loading...