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!
You can always check out skUnity Downloads for downloads and any other information about Skript!
on death of player:
set {kills::%name of attacker%} to value "Stats.%attacker%.Kills" get of "plugins/KitPVP/stats.yml"
command /top:
trigger:
loop {kills::*}:
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--------------TOP KILLS---------------"
loop {_high.to.low.list::*}:
add 1 to {_topnumber}
set {_player} to "%loop-value%" parsed as offlineplayer
send "&7%{_topnumber}% - &e%{_player}% &7with &9%{kills::%loop-value%}% Kills"
add 1 to {_i}
if {_topnumber} > 10: #this is top 10 you can change it
stop
send "&7--------------TOP KILLS---------------"
%player% returns the name of a player. Not "none"You need to get the amount of kills from the yml player and put this variable {kills.%name of player%}
Remember: Use {kills::%name of player%} If you use {kills::%player%} Will return none
code_language.skript:on death of player: set {kills::%name of attacker%} to value "Stats.%attacker%.Kills" get of "plugins/KitPVP/stats.yml"
code_language.skript:command /top: trigger: loop {kills::*}: 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--------------TOP KILLS---------------" loop {_high.to.low.list::*}: add 1 to {_topnumber} set {_player} to "%loop-value%" parsed as offlineplayer send "&7%{_topnumber}% - &e%{_player}% &7with &9%{kills::%loop-value%}% Kills" add 1 to {_i} if {_topnumber} > 10: #this is top 10 you can change it stop send "&7--------------TOP KILLS---------------"
RESULT
In this code it returns none, try it yourself%player% returns the name of a player. Not "none"
Because you need to use "parsed as player". %player% is better than %name of player% because %player% supports the uuid config option.In this code it returns none, try it yourself
The {kills::%player%} that @FilipeNock suggested is pointless, all you need to do is loop through all nodes / values and set a local variable to the kill amount then sort it. The local variables get deleted after it is done...The point of using YAML is haveing less variables...
So i do not want to get stats variables.
Since you are here, saying that my help is useless, help him yourself, I have more things to doThe {kills::%player%} that @FilipeNock suggested is pointless, all you need to do is loop through all nodes / values and set a local variable to the kill amount then sort it. The local variables get deleted after it is done...
Can you please give me an example?The {kills::%player%} that @FilipeNock suggested is pointless, all you need to do is loop through all nodes / values and set a local variable to the kill amount then sort it. The local variables get deleted after it is done...
I did by telling him what to do instead. I can type skript code rn because I'm on a phone.Since you are here, saying that my help is useless, help him yourself, I have more things to do
Can't right now, I'm on a phone.Can you please give me an example?
Use skUtilities for the YML stuff, WildSkript is discontinued.code_language.skript:set {kills::%name of attacker%} to value "Stats.%attacker%.Kills" get of "plugins/KitPVP/stats.yml"