Biggest amount of a certain variable

  • 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!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

CyberRyan

Member
Nov 18, 2018
3
0
0
23
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.
 
This is a pretty popular skript. Maybe you can handle something out of it
code_language.skript:
command /topkills:
    trigger:
        loop {kill::*}:
            add 1 to {_size}
            if {_low.to.high.list::%loop-value%} is not set:
                set {_low.to.high.list::%loop-value%} to loop-index
            else:
                set {_n} to 0
                loop {_size} times:
                    set {_n} to {_n}+1
                    {_low.to.high.list::%loop-value-1%.%{_n}%} is not set
                    set {_low.to.high.list::%loop-value-1%.%{_n}%} to loop-index
                    stop loop
        wait 1 tick
        set {_n} to size of {_low.to.high.list::*}
        loop {_low.to.high.list::*}:
            set {_high.to.low.list::%{_n}%} to loop-value
            set {_n} to {_n}-1
        wait 1 tick
        set {_i} to 0
#THIS IS THE MESSAGE WITH TOP KILLS
        send "&7&m-----------&8< &6Top10 &8>&7&m-----------"
        loop {_high.to.low.list::*}:
            add 1 to {_topnumber}
            set {_player} to "%loop-value%" parsed as offlineplayer
            send "&7%{_topnumber}% - &c%{_player}% &8» &7%{kill::%loop-value%}% Kills"
            add 1 to {_i}
            if {_topnumber} > 9: #this is top 10 you can change it
                stop
        send "&7&m------------------------------"
 
code_language.skript:
loop {money::*}:
    if {_l} is not set:
        set {_l} to loop-value
        set {_o} to loop-index
    else:
        loop-value > {_l}
        set {_l} to loop-value
        set {_o} to loop-index
message "%{_o}%: %{_l}%"
 
Status
Not open for further replies.