function topUpdate(t: text): loop {Stats.%{_t}%::*}: add 1 to {_size} if {_v::%loop-value%} is not set: set {_v::%loop-value%} to loop-index else: set {_n} to 0 loop {_size} times: set {_n} to {_n}+1 {_v::%loop-value-1%.%{_n}%} is not set set {_v::%loop-value-1%.%{_n}%} to loop-index stop loop wait 1 tick set {_n} to size of {_v::*} loop {_v::*}: set {Top.%{_t}%::%{_n}%} to loop-value set {_n} to {_n}-1 every 1 minute: loop all players: add 1 to {Stats.time::%loop-player%} on join: if {Stats::%player%} is not set: set {Stats.stone::%player%} to 0 set {Stats.kill::%player%} to 0 set {Stats.kox::%player%} to 0 set {Stats.time::%player%} to 0 set {Stats::%player%} to true on death: if attacker is a player: if victim is a player: add 1 to {Stats.kill::%attacker%} on mine of stone: add 1 to {Stats.stone::%player%} on eat: if player's tool is enchanted golden apple: add 1 to {Stats.kox::%player%} command /top: trigger: open chest with 3 rows named "&7Topki graczy" to player topUpdate(stone) topUpdate(kill) topUpdate(kox) topUpdate(time) set slot 10 of player's current inventory to stone named "&c&lKopacze" with lore "&7Prowadzi&8: &a%{Top.stone::1}%" set slot 12 of player's current inventory to diamond sword named "&c&lMordercy" with lore "&7Prowadzi&8: &a%{Top.kill::1}%" set slot 14 of player's current inventory to golden apple named "&c&lGlodomory" with lore "&7Prowadzi&8: &a%{Top.kox::1}%" set slot 16 of player's current inventory to clock named "&c&lManiacy" with lore "&7Prowadzi&8: &a%{Top.time::1}%" on inventory click: if inventory name of player's current inventory is "&7Topki graczy": cancel event if clicked item is not air: close player's inventory wait 1 tick open chest with 1 rows named "&7Top 9" to player set {_} to 0 set {_n} to 1 if clicked slot is 10: set {_t} to "stone" if clicked slot is 12: set {_t} to "kill" if clicked slot is 14: set {_t} to "kox" if clicked slot is 16: set {_t} to "time" loop {Top.%{_t}%::*}: set {_p} to loop-value parsed as offlineplayer set slot {_} of player's current inventory to {_p}'s skull named "&c&l%{_n}%. %{_p}%" with lore "&7Statystyki&8: &a%{Stats.%{_t}%::%{_p}%}%" add 1 to {_} add 1 to {_n} if {_n} is 9: exit loop