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.

Biggest amount of a certain variable

Discussion in 'Skript' started by CyberRyan, Dec 16, 2018.

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

    CyberRyan Member

    Joined:
    Nov 18, 2018
    Messages:
    3
    Likes Received:
    0
    How would you make a skript that finds the person with the biggest amount of a certain variable?

    Like if I have 500 money and another person has 200 money, then it will select me.
     
  2. Runakai

    Moderator Supporter

    Joined:
    Apr 27, 2018
    Messages:
    493
    Likes Received:
    31
    This is a pretty popular skript. Maybe you can handle something out of it
    Code (Skript):
    1.  
    2. command /topkills:
    3.     trigger:
    4.         loop {kill::*}:
    5.             add 1 to {_size}
    6.             if {_low.to.high.list::%loop-value%} is not set:
    7.                 set {_low.to.high.list::%loop-value%} to loop-index
    8.             else:
    9.                 set {_n} to 0
    10.                 loop {_size} times:
    11.                     set {_n} to {_n}+1
    12.                     {_low.to.high.list::%loop-value-1%.%{_n}%} is not set
    13.                     set {_low.to.high.list::%loop-value-1%.%{_n}%} to loop-index
    14.                     stop loop
    15.         wait 1 tick
    16.         set {_n} to size of {_low.to.high.list::*}
    17.         loop {_low.to.high.list::*}:
    18.             set {_high.to.low.list::%{_n}%} to loop-value
    19.             set {_n} to {_n}-1
    20.         wait 1 tick
    21.         set {_i} to 0
    22. #THIS IS THE MESSAGE WITH TOP KILLS
    23.         send "&7&m-----------&8< &6Top10 &8>&7&m-----------"
    24.         loop {_high.to.low.list::*}:
    25.             add 1 to {_topnumber}
    26.             set {_player} to "%loop-value%" parsed as offlineplayer
    27.             send "&7%{_topnumber}% - &c%{_player}% &8» &7%{kill::%loop-value%}% Kills"
    28.             add 1 to {_i}
    29.             if {_topnumber} > 9: #this is top 10 you can change it
    30.                 stop
    31.         send "&7&m------------------------------"
     
  3. TPGamesNL

    Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,500
    Likes Received:
    102
    Medals:
    Code (Skript):
    1. loop {money::*}:
    2.     if {_l} is not set:
    3.         set {_l} to loop-value
    4.         set {_o} to loop-index
    5.     else:
    6.         loop-value > {_l}
    7.         set {_l} to loop-value
    8.         set {_o} to loop-index
    9. message "%{_o}%: %{_l}%"
     
Thread Status:
Not open for further replies.

Share This Page

Loading...