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.

Leaderboard

Discussion in 'Skript' started by LukynkaCZE, Jul 22, 2019.

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

    LukynkaCZE Member

    Joined:
    May 12, 2019
    Messages:
    26
    Likes Received:
    2
    Hi, I want to make a leaderboard.

    The one who has the most {points ::% player%} is on top and the others are sorted in descending order below


    I've tried something but nothing worked.


    Please help :emoji_slight_smile:
     
  2. couger44

    Supporter

    Joined:
    Feb 19, 2017
    Messages:
    714
    Likes Received:
    31
    Try:
    Code (Skript):
    1.  
    2. on command "/ptop":
    3.     cancel event
    4.    
    5.     loop {points::*}:
    6.             add 1 to {_size}
    7.             if {_low.to.high.list::%loop-value%} is not set:
    8.                 set {_low.to.high.list::%loop-value%} to loop-index
    9.             else:
    10.                 set {_n} to 0
    11.                 loop {_size} times:
    12.                     set {_n} to {_n}+1
    13.                     {_low.to.high.list::%loop-value-1%.%{_n}%} is not set:
    14.                         set {_low.to.high.list::%loop-value-1%.%{_n}%} to loop-index
    15.                         stop loop
    16.         wait 1 tick
    17.         set {_n} to size of {_low.to.high.list::*}
    18.         loop {_low.to.high.list::*}:
    19.             set {_high.to.low.list::%{_n}%} to loop-value
    20.             set {_n} to {_n}-1
    21.         wait 1 tick
    22.         set {_i} to 0
    23.            
    24.         message "&a&lPOINTS TOP" to player
    25.         loop {_high.to.low.list::*}:
    26.             add 1 to {_topnumber}
    27.             set {_player} to "%loop-value%" parsed as offlineplayer
    28.             add 1 to {_i}
    29.             message "&8%{_topnumber}%.- &a%{_player}% &8» &a%{points::%loop-value%}% Points"
    30.             if {_topnumber} > 9: #or the number of the number of positions you want to have in your leaderboard.
    31.                 stop loop
     
  3. novastosha

    novastosha Well-Known Member

    Joined:
    Jan 11, 2019
    Messages:
    344
    Likes Received:
    22
    Register // Don't use on command to run a trigger but Register it as command Because it has less packet sending
     
  4. malia

    malia Well-Known Member

    Joined:
    Jul 24, 2019
    Messages:
    314
    Likes Received:
    21
    tip: you should save those values so you don't get oof'd by restarts :emoji_slight_smile:
     
    • Agree Agree x 1
Thread Status:
Not open for further replies.

Share This Page

Loading...