and also Sell is <none>
Code:
Code:
function sell(p: player, i: item, n: number):
set {_uuid} to uuid of {_p}
set {_count} to amount of {_i} in {_p}'s inventory
set {_sell} to {_count} * {_n}
remove all {_i} from {_p}'s inventory
set {_beforeBooster} to {_sell}
set {_boosterAmount} to {_sell} * {booster::%{_uuid}%}
add {_boosterAmount} to {_sell}
add {_sell} to {balance::%{_uuid}%}
set {_beforeBooster} to split("%{_beforeBooster}%")
set {_boosterAmount} to split("%{_boosterAmount}%")
if {_sell} = 0:
send "&a&lShop &8? &7You have no items to sell" to {_p}
playSound("ENTITY_VILLAGER_NO", {_p})
else:
send " " to {_p}
send "&a&lShop &8? &7You earned &a$%{_beforeBooster}%" to {_p}
send "&a&lShop &8 &7Your booster gave you an extra &a$%{_boosterAmount}% &7(&ex%{booster::%{_uuid}%}%&7)" to {_p}
send " " to {_p} #Sell Code
Code:
function setShop(slot: integer, player: player, amount: integer, item: item, name: string, lore: strings, sell: number, buy: number):
set {_uuid} to uuid of {_player}
set {_buyMoney} to split("%{_buy} * {_amount}%")
set {_sellAmount} to split("%{_sell}%")
add "&aPrice: " and "&a* &fBuy Price (x%{_amount}%): &a$%{_buyMoney}%" to {_lore::*}
if {_sell} = 0:
add "&a* &fSell Price (ea): &cNot Sellable" and " " to {_lore::*}
if {_sell} >= 1:
add "&a* &fSell Price (ea): &c$%{_sellAmount}%" and " " to {_lore::*}
if {_sell} >= 1:
format gui slot {_slot} of {_player} with {_amount} of {_item} named {_name} with lore {_lore::*} to run with "right" click:
sell({_player}, {_item}, {_sell})
format gui slot {_slot} of {_player} with {_amount} of {_item} named {_name} with lore {_lore::*} to run with "left" click:
set {_money} to {_buy} * {_amount}
if {_player} has enough space for {_amount} of {_item}:
if {balance::%{_uuid}%} >= {_money}:
give {_player} {_amount} of {_item}
remove {_money} from {balance::%{_uuid}%}
set {_show} to split("%{_money}%")
send "&a&lShop &8? &7You bought items that costed &a$%{_show}%"
playSound("ENTITY_VILLAGER_YES", player)
else:
send "&a&lShop &8? &7You do not have enough money to buy this item" to {_player}
playSound("ENTITY_VILLAGER_NO", player)
else:
send "&a&lShop &8? &7You do not have enough space to buy this item" to {_player}
playSound("ENTITY_VILLAGER_NO", player) #Buy Code
Last edited: