Advertisement
Guest User

Untitled

a guest
Jan 25th, 2020
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.75 KB | None | 0 0
  1. options:
  2. AMOUNT_Grass: 8
  3. SINGLE_Grass: 5
  4. AMOUNT_Dirt: 8
  5. SINGLE_Dirt: 3
  6. AMOUNT_Redstone: 8
  7. SINGLE_Redstone: 10
  8. BUY_Redstone: %{@AMOUNT_Redstone}*{@SINGLE_Redstone}%
  9.  
  10. function setShop(slot: integer, player: player, amount: integer, item: item, buy: number, menu: string):
  11. if inventory name of {_player}'s current inventory is "&2{_menu}":
  12. if event-slot is {_slot}:
  13. if {_player}'s balance is more than {_buy}:
  14. if {_player} can hold {_amount} {_item}:
  15. remove {_buy} from {_player}'s balance
  16. give {_player} {_amount} {_item}
  17. else:
  18. send "&cYou do not have enough inventory space."
  19. play sound "ENTITY_VILLAGER_NO" at player
  20. else:
  21. send "&cYou do not have the suffcient funds."
  22. play sound "ENTITY_VILLAGER_NO" at player
  23.  
  24. command /shop [<text>]:
  25. trigger:
  26. if arg 1 is "blocks":
  27. open virtual chest with size 5 named "&2Blocks" to player
  28. set {_slot} to 0
  29. loop 45 times:
  30. format a gui slot {_slot} of player with dark gray stained glass pane named "&f" to do nothing
  31. add 1 to {_slot}
  32. format a gui slot 10 of player with {@AMOUNT_Grass} grass block named "&2Grass Block" with lore "&a$%{@AMOUNT_Grass}*{@SINGLE_Grass}%"
  33. format a gui slot 11 of player with {@AMOUNT_Dirt} dirt block named "&2Dirt" with lore "&a$%{@AMOUNT_Dirt}*{@SINGLE_Dirt}%"
  34. format a gui slot 40 of player with barrier named "&cBack" to run player command "/shop"
  35. if arg 1 is "redstone":
  36. open virtual chest with size 5 named "&2Redstone" to player
  37. set {_slot} to 0
  38. loop 45 times:
  39. format a gui slot {_slot} of player with dark gray stained glass pane named "&f" to do nothing
  40. format a gui slot 10 of player with {@AMOUNT_Redstone} redstone item named "&2Redstone" with lore "&a$%{@AMOUNT_Redstone}*{@SINGLE_Redstone}%"
  41. format a gui slot 40 of player with barrier named "&cBack" to run player command "/shop"
  42. add 1 to {_slot}
  43. if arg 1 is not set:
  44. open chest with 1 row named "&2Shop" to player
  45. format a gui slot 0 of player with grass block named "&2Blocks" to run player command "/shop blocks"
  46. format a gui slot 1 of player with redstone item named "&2Redstone" to run player command "/shop redstone"
  47.  
  48. on inventory click:
  49. setShop(10, player, 8, grass block, {@BUY_Redstone}, blocks)
  50.  
  51. on inventory click:
  52. set {_click} to clicked slot
  53. set {_click2} to clicked item
  54. broadcast "%{_click}%"
  55. broadcast "%{_click2}%"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement