l1j Posted December 19, 2019 Share Posted December 19, 2019 I currently have code that is working fine and all, but everytime the command is run it loops the variable and could easily crash the server if someone were to spam it. I was wondering if anyone knew an alternate way to do this so that it didn't lag the server if someone spammed it but still worked fine. command /top balance: trigger: loop {money::*}: 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 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$%format({money::%loop-value%})%" add 1 to {_i} if {_topnumber} > 10: stop send "&7&m------------------------------" Link to comment Share on other sites More sharing options...
Swayl Posted December 20, 2019 Share Posted December 20, 2019 use morkazSK Things to know about me • I have 2 years of skript experience • I work on my servers all by myself• I like being alone • I have insane trust issues • I simp for alot of people (trying my best not to) • My mental age is somewhere 8 • I dont like meeting new people • Very toxic Discord - Swayl#0099 MC IGN - Swayl (I suggest avoiding me because I get too attached to people quick) Link to comment Share on other sites More sharing options...
Swayl Posted December 20, 2019 Share Posted December 20, 2019 command /killtop [<text>]: aliases:kt trigger: set {_top} to 5 send "" send " &b&lKill top &3(Top 5 Killers)" send "" set {_top::*} to sorted {kills::*} from highest to lowest with format "@index" # Assuming {kills::%uuid of player%} is your kills variable loop {_top::*}: add 1 to {_n} set {_p} to "%loop-value%" parsed as offline player set {_player} to {_p}'s uuid send " &3(##%{_n}%) &b%{_p}% &3(%{kills::%{_player}%}% kills)" if {_n} is {_top}: stop loop send "" Things to know about me • I have 2 years of skript experience • I work on my servers all by myself• I like being alone • I have insane trust issues • I simp for alot of people (trying my best not to) • My mental age is somewhere 8 • I dont like meeting new people • Very toxic Discord - Swayl#0099 MC IGN - Swayl (I suggest avoiding me because I get too attached to people quick) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now