# #Created by Kyrizmo # #Shop API # function Sell(type: text, item: item type, price: num, p: player):   set {_amount} to amount of {_item} in {_p}'s inventory   set {_totalProfit} to {_amount} * {_price}   set {_v::*} to vanilla name of {_item}   replace all "minecraft:" and "_block" with "" in {_v::1}   replace all "_" with " " in {_v::1}   if {_type} contains "all":     if {_amount} is greater than or equal to 1:       add ({_amount} * {_price}) to {_p}'s balance       send "&e&l(!) &eYou successfully sold all &6&n%{_v::1}%&7 (&8%{_amount}%&8x&7) &efor &6&n$%{_totalProfit}%" to {_p}       remove all {_item} from {_p}     else:       send "&e&l(!) &eYou don't have enough &6&n%{_v::*}%&e to sell." to {_p}   if {_type} contains "single":     if {_amount} is greater than or equal to 1:       add {_price} to {_p}'s balance       send "&e&l(!) &eYou successfully sold all &6&n%{_v::1}%&7 (&81x&7) &efor &6&n$%{_price}%" to {_p}       remove 1 of {_item} from {_p}     else:       send "&e&l(!) &eYou don't have enough &6&n%{_v::1}%&e to sell." to {_p}        function Buy(item: item type, price: num, p: player):   set {_v::*} to vanilla name of {_item}   replace all "minecraft:" and "_block" with "" in {_v::1}   replace all "_" with " " in {_v::1}   if {_p}'s balance is greater than or equal to {_price}:     remove {_price} from {_p}'s balance     give {_p} 1 of {_item}     send "&e&l(!) &eYou successfully bought &71x &6&n%{_v::1}%&e for &6&n$%{_price}%&e." to {_p}   else:     send "&e&l(!) &eYou don't have enough money, you need &6&n$%{_price}%&e to buy this item." to {_p} ### #EXAMPLE ### #format a gui slot 0 of player with stone lored "&6&l* &e[Buyable] &f$3 #&7per%newline%&6&l* &e[Sellable] &f$0.01 &7per%newline%%newline%&e[Click to Transact]%newline%%newline%&7&o #(( Tip: Use middle mouse button to sell all. ))" to run: # if click type is left mouse button: # Buy(stone, 3, player) # if click type is middle mouse button: # Sell("all", stone, 0.01, player) # if click type is right mouse button: # Sell("single", stone, 0.01, player)