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!

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

Solved /baltop command

Discussion in 'Requests' started by Trixxer, Oct 29, 2021.

  1. Trixxer

    Trixxer New Member

    Joined:
    Oct 29, 2021
    Messages:
    7
    Likes Received:
    0
    can somebody make a baltop command for me, i'd like it appear before 2/11/2021 (british format) 19:30 GMT+1

    i'm using 2.5-beta3 and paperspigot 1.16, skellet, sknbeet, skquery and skript-db
     
    #1 Trixxer, Oct 29, 2021
    Last edited: Oct 29, 2021
  2. oToghty

    VIP Supporter +

    Joined:
    Sep 1, 2020
    Messages:
    143
    Likes Received:
    5
    A ball top using what currency? player's balance?
     
  3. Trixxer

    Trixxer New Member

    Joined:
    Oct 29, 2021
    Messages:
    7
    Likes Received:
    0
    no its like using {###::*} to get the sorted list to the top 10 highest values (biggest to smallest) (including the plr names)
     
  4. Minecoll_YT

    Supporter Forums Helper

    Joined:
    Dec 2, 2018
    Messages:
    650
    Likes Received:
    40
    You know, there are many scripts that already do that, and you just have to change the variable?
     
  5. Trixxer

    Trixxer New Member

    Joined:
    Oct 29, 2021
    Messages:
    7
    Likes Received:
    0
    i tried one of those but i always get a condition error with 'the size of' something idk, plus im using 2.5-beta3 so yeah thats why lmao
     
  6. oToghty

    VIP Supporter +

    Joined:
    Sep 1, 2020
    Messages:
    143
    Likes Received:
    5
    Code (Text):
    1. function sort(indices: strings, values: numbers, descending: boolean = true) :: strings:
    2.     loop {_indices::*}:
    3.         set {_whole} to rounded down {_values::%loop-index%}
    4.         set {_fraction} to mod({_values::%loop-index%}, 1) * 1E+10
    5.         set {_sort::%{_whole}%.%{_fraction}%::%loop-index%} to loop-value
    6.     loop indices of {_sort::*}:
    7.         loop {_sort::%loop-value%::*}:
    8.             add 1 to {_index}
    9.             set {_final::%{_index}%} to loop-value-2
    10.     return (reversed {_final::*}) if {_descending} is true, else {_final::*}
    11.  
    12. command /top:
    13.     trigger:
    14.         set {_sorted::*} to sort((indices of {your variable::*}), {your variable::*})
    15.         loop 10 times:
    16.             set {_p} to {_sorted::%loop-number%} parsed as offline player
    17.             send "%loop-number%. %{_p}%: %{your variable::%{_p}%}%"
    That should work, change "your variable" to the name of your variable
     
  7. Trixxer

    Trixxer New Member

    Joined:
    Oct 29, 2021
    Messages:
    7
    Likes Received:
    0
    alright, will try it later
    --- Double Post Merged, Nov 2, 2021, Original Post Date: Nov 2, 2021 ---
    didnt work, it uses uuids to store data so when i run the command it always appears with <none> for the balance so like this {eco::###} hashtags are the uuid of the player
     
    #7 Trixxer, Nov 2, 2021
    Last edited: Nov 2, 2021
  8. oToghty

    VIP Supporter +

    Joined:
    Sep 1, 2020
    Messages:
    143
    Likes Received:
    5
    send your code
     
  9. Trixxer

    Trixxer New Member

    Joined:
    Oct 29, 2021
    Messages:
    7
    Likes Received:
    0
    2.5-beta3 btw not the latest because yes (paperspigot 1.16) also
    Code (Text):
    1. function sort(indices: strings, values: numbers, descending: boolean = true) :: strings:
    2.     loop {_indices::*}:
    3.         set {_whole} to rounded down {_values::%loop-index%}
    4.         set {_fraction} to mod({_values::%loop-index%}, 1) * 1E+10
    5.         set {_sort::%{_whole}%.%{_fraction}%::%loop-index%} to loop-value
    6.     loop indices of {_sort::*}:
    7.         loop {_sort::%loop-value%::*}:
    8.             add 1 to {_index}
    9.             set {_final::%{_index}%} to loop-value-2
    10.     return (reversed {_final::*}) if {_descending} is true, else {_final::*}
    11.  
    12. command /top:
    13.     trigger:
    14.         set {_sorted::*} to sort((indices of {eco::*}), {eco::*})
    15.         loop 10 times:
    16.             set {_p} to {_sorted::%loop-number%} parsed as offline player
    17.             send "%loop-number%. %{_p}%: %{eco::%uuid of {_p}%}%"
     
  10. oToghty

    VIP Supporter +

    Joined:
    Sep 1, 2020
    Messages:
    143
    Likes Received:
    5
    You said you used uuids to store data so why do you parse as offline player then get uuid again
    try this
    Code (Text):
    1. command /top:
    2.     trigger:
    3.         set {_sorted::*} to sort((indices of {eco::*}), {eco::*})
    4.         loop 10 times:
    5.             set {_uuid} to {_sorted::%loop-number%}
    6.             set {_p} to {_sorted::%loop-number%} parsed as offline player
    7.             send "%loop-number%. %{_p}%: %{eco::%{_uuid}%}%"
    Also please update, you're 10 versions behind.
     
  11. Trixxer

    Trixxer New Member

    Joined:
    Oct 29, 2021
    Messages:
    7
    Likes Received:
    0
    cant because cubedcraft's limitations are really bad
    --- Double Post Merged, Nov 7, 2021, Original Post Date: Nov 7, 2021 ---
    anyways it worked aweusm ty
     

Share This Page

Loading...