Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- command /shop [<text>]:
- trigger:
- open chest with 6 row named "&cShop" to player
- wait 2 tick
- set {_slot} to 0
- loop 54 times:
- format slot {_slot} of player with gray glass named "&7" to be unstealable
- add 1 to {_slot}
- format slot 10 of player with grass named "&2&lBlocks" to run [make player execute command "/shop blocks"]
- format slot 12 of player with redstone named "&c&lRedstone" to run [make player execute command "/shop redstone"]
- format slot 14 of player with seeds named "&a&LCrops" to run [make player execute command "/shop crops"]
- format slot 16 of player with water bucket named "&3&lMiscellaneous" to run [make player execute command "/shop mis"]
- format slot 20 of player with diamond hoe named "&b&lTools" to run [make player execute command "/shop tools"]
- format slot 22 of player with mob_spawner named "&8&lSpawners" to run [make player execute command "/shop spawners"]
- format slot 24 of player with dispenser named "&7&lMachines" to run [make player execute command "/shop machines"]
- format slot 40 of player with blaze rod named "&6&LSell Wands" to run [make player execute command "/shop wand"]
- if arg-1 is "blocks":
- open chest with 6 row named "&2&lBlocks" to player
- wait 2 tick
- set {_slot} to 0
- loop 54 times:
- format slot {_slot} of player with gray glass named "&7" to be unstealable
- add 1 to {_slot}
- create gui slot 10 of player with 64 stone named "&7Stone" with lore "&c$100" to run function buyItem(player, 100, 1:0)
- on inventory click:
- if inventory name of player's current inventory is "&cShop" or "&2&lBlocks":
- cancel event
- function buyItem(p: player, cost: integer, i: item):
- if {_p}'s balance >= {_cost}:
- remove {_cost} from {_p}'s balance
- give 64 of {_i} to {_p}
- else:
- send "&cYou cannot afford this item!" to {_p}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement