Where can I add command execution after purchasing an item?
Code:
function buySlot(p: player, base: integer):
set {_uuid} to uuid of {_p}
set {_price} to (100000*{_base})
if {base::%{_uuid}%} is less than {_base}:
if {base::%{_uuid}%}+1 is {_base}:
if balance of {_p} is more than or equal to {_price}:
remove {_price} from balance of {_p}
add 1 to {base::%{_uuid}%}
send "&aSuccessfully purchased this item." to {_p}
else:
send "&cError: &aNot enough money." to {_p}
else:
send "&cError: &aBuy first&n%{base::%{_uuid}%}+1%&r &arank." to {_p}
else:
send "&cError: &aYou already purchased this." to {_p}
Code:
on inventory click:
if inventory name of current inventory of player is "&2&lРанги":
cancel event
if clicked slot is 10:
if name of clicked slot contains "&a&lUPGRADE&8:":
set {_x} to uncolored name of clicked slot
replace all "UPGRADE: " with "" in {_x}
set {_base} to {_x} parsed as a integer
buySlot(player, {_base})