leaderboard help

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

    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.

titustitus98

Member
Feb 19, 2018
47
0
6
so i have this function:

code_language.skript:
function sortLowestToHighest(indexes: strings, values: objects) :: strings:
    set {_size} to size of {_values::*}
    loop {_size} times:
        loop {_size} - 1 times:
            set {_value1} to {_values::%loop-number-2%}
            set {_value2} to {_values::%loop-number-2 + 1%}
            {_value1} is more than {_value2}
            set {_index1} to {_indexes::%loop-number-2%}
            set {_indexes::%loop-number-2%} to {_indexes::%loop-number-2 + 1%}
            set {_values::%loop-number-2%} to {_value2}
            set {_indexes::%loop-number-2 + 1%} to {_index1}
            set {_values::%loop-number-2 + 1%} to {_value1}
        remove 1 from {_size}
    return {_indexes::*}

the var i use for counting the kills is {kills::%player%}

how can i transform this function into a var that i can use as the number 1 player with most kills on featherboard?
[doublepost=1541408123,1541193531][/doublepost]If anyone could show me an example or something it would be much appreciated.
 
So, the function works like this:
code_language.skript:
set {_indexes::*} to sortLowestToHighest({kills::*}'s indexes, {kills::*}) # the list indexes expression needs either MundoSK or a pretty recent version of Skript

set {_top-1} to {kills::%{_indexes::1}%}

send "Top 1 Kills: %{_indexes::1}% - %{_top-1}%"
 
So, the function works like this:
code_language.skript:
set {_indexes::*} to sortLowestToHighest({kills::*}'s indexes, {kills::*}) # the list indexes expression needs either MundoSK or a pretty recent version of Skript

set {_top-1} to {kills::%{_indexes::1}%}

send "Top 1 Kills: %{_indexes::1}% - %{_top-1}%"
So my function would then look something like this:


code_language.skript:
function sortLowestToHighest(indexes: strings, values: objects) :: strings:

set {_indexes::*} to sortLowestToHighest({kills::*}'s indexes, {kills::*})
 
set {_top-1} to {kills::%{_indexes::1}%}
 
send "Top 1 Kills: %{_indexes::1}% - %{_top-1}%"
 
So my function would then look something like this:


code_language.skript:
function sortLowestToHighest(indexes: strings, values: objects) :: strings:

set {_indexes::*} to sortLowestToHighest({kills::*}'s indexes, {kills::*})
 
set {_top-1} to {kills::%{_indexes::1}%}
 
send "Top 1 Kills: %{_indexes::1}% - %{_top-1}%"
No.. you would use what he provided when you are sending the message to someone.
 
No.. you would use what he provided when you are sending the message to someone.
No i am trying to make it work on featherboard.
[doublepost=1541494281,1541440636][/doublepost]Considering the fact that you can use skript with MVDWPlaceholderAPI using the following placeholder: {skript:skriptvar}
 
No i am trying to make it work on featherboard.
[doublepost=1541494281,1541440636][/doublepost]Considering the fact that you can use skript with MVDWPlaceholderAPI using the following placeholder: {skript:skriptvar}
Not sure then. Don’t know if PlaceholderAPI placeholders work on mvdwplaceholderapi, you’ll have to double check.
 
Not sure then. Don’t know if PlaceholderAPI placeholders work on mvdwplaceholderapi, you’ll have to double check.
featherboard does not work with placeholderAPI only with MVDWPlaceholderAPI i just want a function that gives me a placeholder that i can use to display the top kill
[doublepost=1541513050,1541511303][/doublepost]ok so i have found out that i need to make a sorting function and then set the sorted list to a seperate var but idk how to do this so if anyone could show me an example i would be very gratefull.
 
featherboard does not work with placeholderAPI only with MVDWPlaceholderAPI i just want a function that gives me a placeholder that i can use to display the top kill
[doublepost=1541513050,1541511303][/doublepost]ok so i have found out that i need to make a sorting function and then set the sorted list to a seperate var but idk how to do this so if anyone could show me an example i would be very gratefull.
You already have a sorting function and an output variable. Just set the result to a seperate variable then display it on featherboard.
 
Status
Not open for further replies.