function createTop(name: string, size: number, list: objects, format: string="[PLAYER] - [VALUE]") :: strings:
set {_index} to 1
loop {_list::*}:
if {%{_name}%::%loop-value%} is set:
if {%{_name}%::%loop-value%} is a number:
set {_top::%{_index}%} to {%{_name}%::%loop-value%}
set {_players::%{_index}%} to "%loop-value%"
add 1 to {_index}
if {_size} > (size of {_players::*}):
set {_size} to (size of {_players::*})
loop {_size} times:
loop {_top::*}:
if {_max} is not set:
set {_max} to loop-value-2
set {_index} to loop-index
else:
if loop-value-2 > {_max}:
set {_max} to loop-value-2
set {_index} to loop-index
set {_var} to {_format}
replace "[PLAYER]" with {_players::%{_index}%} in {_var}
replace "[INDEX]" with "%loop-number%" in {_var}
replace "[VALUE]" with "%{_max}%" in {_var}
add {_var} to {_return::*}
delete {_players::%{_index}%}, {_top::%{_index}%}, {_max} and {_index}
return {_return::*}
function getMoney(p: player) :: number:
if {money::%{_p}%} is not set:
return 0
return {money::%{_p}%}
command /money [<player>]:
aliases: /bal, /balance, /kasa, /coins
trigger:
if arg is not set:
send "&7Twoj stan konta: &6%getMoney(player)%"
stop
send "&&Stan konta gracza &e%arg%&7: &6%getMoney(arg)%"
command /addcoins [<player>] [<number=50>]:
permission: addcoin
trigger:
if arg 1 is not set:
send "&7Poprawne uzycie: &6/addcoins &a<player> <number>"
stop
add arg 2 to {money::%arg 1%}
send "&7Twoj nowy stan konta: &6%{money::%arg 1%}%" to arg 1
send "&7Ustawiles stan konta gracza: &a%arg 1% &7na &6%{money::%arg 1%}%"
command /top [<text>]:
aliases: /cointop
trigger:
open chest with 1 rows named "&6Topka coinsow" to player
set player's current inventory's slot 4 to gold ingot named "&6Top 3 posiadanych coinsow" with lore createTop("money", 3, all offline players, "&6[INDEX]. &a[PLAYER]: &6[VALUE]")
on inventory click:
if inventory name of current inventory of player is "&6Topka coinsow":
cancel event
nie testowane
@gamemoefx i jak?