The document details code for a shop plugin, including commands to open a shop GUI with categories, functions for selling items via GUI, and confirming/completing sales by removing items and adding money to the player's balance.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
43 views2 pages
Sell
The document details code for a shop plugin, including commands to open a shop GUI with categories, functions for selling items via GUI, and confirming/completing sales by removing items and adding money to the player's balance.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2
# SHOP
command /shop [<text>]:
trigger: create a gui with virtual chest inventory with 3 rows named "<##41FBBF>Tropical Categories": loop 27 times: make next gui slot with gray_stained_glass make gui slot 10 with dirt named "<##9C6F49>Blocks Category" with lore " ", "&7Click here to open this category": shopBlocks(player)# not skripted make gui slot 11 with iron pickaxe named "&8Tools" with lore ", "&7Click here to open this category": shopTools(player)# not skripted make gui slot 12 with oak log named "&aForaging Category" with lore " ", "&7Click here to open this category": shopForaging(player)# not skripted make gui slot 13 with beacon named "&bGenerator Category" with lore " ", "&7Click here to open this category": shopGen(player)# not skripted make gui slot 14 with redstone dust named "&dColoured Blocks" with lore " ", "&7Click here to open this category": shopCBlocks(player)# not skripted make gui slot 15 with diamond named "Farming Category" with lore " ", "&7Click here to open this category": shopFarming(player) make gui slot 16 with name tag named "&eMiscellaneous Category" with lore " ", "&7Click here to open this category": shopMisc(player)# not skripted make gui slot 22 with nether star named "&bPerks:" with lore "&fGet genslots, sellwands & ranks: /buy" and "&7&o(click me to automatically go to /buy!)": make player execute command "/buy" open last gui to player # FUNCTIONS function sellItemAmount(plr: player, cost: number, item: itemtype, amount: integer = 0, recall: boolean = false): set {_uuid} to uuid of {_plr} Lib_PlaySoundOne({_plr}, "ENTITY.EXPERIENCE_ORB.PICKUP", 1.0) if {_recalled} = false set {_guiName} to "&b&lUtopiaGens Selling %{_item}%" set {shop::itemAmount::%{_uuid}%} to {_amount} replace " item" in {_guiName} with "" create a gui with virtual chest inventory with 5 rows named {_guiName}: loop 54 times: make next gui slot with {@filler} make gui slot 10 with emerald block named "&aAdd 1": add 1 to {shop::itemAmount::%{_uuid}%} sellItemAmount({_plr}, {_cost}, {_item}, {shop::itemAmount::%{_uuid}%}, true) make gui slot 11 with emerald block named "&aAdd 16": add 16 to {shop::itemAmount::%{_uuid}%} sellItemAmount({_plr}, {_cost}, {_item}, {shop::itemAmount::%{_uuid}%}, true) make gui slot 12 with emerald block named "&aAdd 32": add 32 to {shop::itemAmount::%{_uuid}%} sellItemAmount({_plr}, {_cost}, {_item}, {shop::itemAmount::%{_uuid}%}, true) make gui slot 13 with emerald block named "&aAdd 64": add 64 to {shop::itemAmount::%{_uuid}%} sellItemAmount({_plr}, {_cost}, {_item}, {shop::itemAmount::%{_uuid}%}, true) make gui slot 14 with emerald block named "&aAdd 128": add 128 to {shop::itemAmount::%{_uuid}%} sellItemAmount({_plr}, {_cost}, {_item}, {shop::itemAmount::%{_uuid}%}, true) make gui slot 28 with redstone block named "&cRemove 1": remove 1 from {shop::itemAmount::%{_uuid}%} sellItemAmount({_plr}, {_cost}, {_item}, {shop::itemAmount::%{_uuid}%}, true) make gui slot 29 with redstone block named "&cRemove 16": remove 16 from {shop::itemAmount::%{_uuid}%} sellItemAmount({_plr}, {_cost}, {_item}, {shop::itemAmount::%{_uuid}%}, true) make gui slot 30 with redstone block named "&cRemove 32": remove 32 from {shop::itemAmount::%{_uuid}%} sellItemAmount({_plr}, {_cost}, {_item}, {shop::itemAmount::%{_uuid}%}, true) make gui slot 31 with redstone block named "&cRemove 64": remove 64 from {shop::itemAmount::%{_uuid}%} sellItemAmount({_plr}, {_cost}, {_item}, {shop::itemAmount::%{_uuid}%}, true) make gui slot 32 with redstone block named "&cRemove 128": remove 128 from {shop::itemAmount::%{_uuid}%} sellItemAmount({_plr}, {_cost}, {_item}, {shop::itemAmount::%{_uuid}%}, true) make gui slot 25 with nametag named "&a&lCONFIRM SELL" with lore "&7Click here to confirm the selling" and "&7Amount: %{shop::itemAmount::%{_uuid}%}%": sellItem({_plr}, {_cost}, {_amount}, {_item}) make gui slot 36 with barrier named "&c&lRETURN" with lore " ", "&aReturn to the main menu" and "": execute player command "/shop" open last gui to {_plr}
function sellItem(plr: player, cost: number, amount: integer, item: itemtype):
set {_uuid} to uuid of {_plr} if {_amount} <= 0: send "&b&lUtopiaGens &cThe amount has to be more than 1." to {_plr} stop if {_plr}'s inventory contains "%{_amount}% of %{_item}%" parsed as itemtype: remove {_amount} of {_item} from {_plr}'s inventory add ({_cost} * {_amount}) to {_plr}'s balance set {_message} to "&b&lUtopiaGens &aYou sold &ax%{_amount}% &a%{_item}% &afor &a$%{_cost} * {_amount}%" replace " item" in {_message} with "" send {_message} to {_plr} stop else: set {_message} to "&b&lUtopiaGens &cYou don't have &f%{_item}% &cin your inventory" replace " item" in {_message} with "" send {_message} to {_plr}