np tak
on load:
set {symbol} to " ---> "
function createTop(t: string, i: integer) :: strings:
set {_offlinePlayers::*} to all offline players
loop {_offlinePlayers::*}:
if {%{_t}%::%loop-value%} is set:
add {%{_t}%::%loop-value%} to {_top::*}
add loop-value to {_players::*}
loop {_i} times:
set {_max} to max({_top::*})
loop {_top::*}:
if loop-value-2 = {_max}:
set {_index} to loop-index
delete {_top::%{_index}%}
add "%{_players::%{_index}%}%%{symbol}%%{_max}%" to {_return::*}
delete {_players::%{_index}%}
return {_return::*}
function getTop(t: string, list: strings) :: strings:
loop {_list::*}:
set {_split::*} to loop-value split at {symbol}
add {_split::1} to {_players::*}
add {_split::2} to {_top::*}
if {_t} = "players":
return {_players::*}
else:
return {_top::*}
options:
format: &f{TOP}. &7{NICK} &8» &3{VALUE} blokow
command /top [<text>]:
trigger:
open chest with 1 rows named "&7Topki" to player
set {_topki::*} to createTop("Stone", 8)
set {_i} to diamond named "&7Top wykopanego Stona"
set {_line} to 1
loop {_topki::*}:
set {_list::*} to loop-value split at " ---> "
set {_f} to "{@format}"
replace all "{TOP}" with "%loop-index%" in {_f}
replace all "{NICK}" with "%{_list::1}%" in {_f}
replace all "{VALUE}" with "%{_list::2}%" in {_f}
set line {_line} of lore of {_i} to colored {_f}
add 1 to {_line}
set player's current inventory's slot 0 to {_i}
on mine:
if event-block is stone:
add 1 to {Stone::%player%}
potem to całe można dać do funkcji i tworzyć tak kolejne topki