Advertisement
Guest User

Shop

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