Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.41 KB | None | 0 0
  1. options:
  2. prefix: &3&lSKYBLOCK
  3.  
  4. command /shop [<text>]:
  5. trigger:
  6. open virtual chest inventory with size 3 named "&3Shop" for player
  7. format gui slot 10 of player with grass block named "&7Building Blocks" to run function shop(player, "Building")
  8. format gui slot 11 of player with redstone dust named "&7Redstone" to run function shop(player, "Redstone")
  9. format gui slot 12 of player with rotten flesh named "&7Mob Drops" to run function shop(player, "Drops")
  10. format gui slot 13 of player with wheat named "&7Farming Supplies" to run function shop(player, "Farming")
  11. format gui slot 14 of player with barrier named "&cComing Soon!"
  12. format gui slot 15 of player with barrier named "&cComing Soon!"
  13.  
  14. function shop(p: player, s: text, page: number=1):
  15. open virtual chest inventory with size 6 named "&3%{_s}% &7($%convertNum({bal::%{_p}%})%)" for {_p}
  16. set {_n} to 0
  17. set {_tPage} to {_page} - 1
  18. set {_tPage-2} to 45*{_p3}
  19. set {_uuid} to uuid of {_p2}
  20. loop {shop::%{_s}%::*}:
  21. if (loop-index parsed as integer) > {_tPage-2}:
  22. set {_s::*} to loop-value split at " - "
  23. set {_i} to "%first element out of {_s::*}%" parsed as item
  24. set {_van::*} to vanilla name of {_i}
  25. set {_van} to first element out of {_van::*}
  26. replace all "minecraft:" in {_van} with ""
  27. replace all "_" in {_van} with " "
  28. set {_price} to "%2nd element out of {_s::*}%" parsed as number
  29. set {_i::*} to ("%{_van}%") split at " "
  30. loop {_i::*}:
  31. if {_name} is not set:
  32. set {_name} to cap(loop-value-2)
  33. else:
  34. set {_name} to "%{_name}% %cap(loop-value-2)%"
  35. format gui slot {_n} of {_p} with {_i} named "&b%{_name}%" lored "&8(&3!&8) &7Price: &b$%convertNum({_price})%" to run function buyitem({_p}, {_i}, {_price}, {_name})
  36. delete {_name}
  37. add 1 to {_n}
  38. if size of {shop::%{_s}%::*} > (27*{_page}):
  39. format gui slot 26 of {_p} with paper named "&8(&3!&8) &7Next Page" to run:
  40. shop({_p}, {-s}, {_page} + 1)
  41. if {_page} > 1:
  42. format gui slot 18 of {_p} with paper named "&8(&3!&8) &7Previous Page" to run:
  43. shop({_p}, {-s}, {_page} - 1)
  44.  
  45. command /additem [<text>] [<number>]:
  46. permission: *
  47. permission message: &cno
  48. trigger:
  49. if arg-1 is not set:
  50. send "{@prefix} &8-- &7Categories: &bBuilding, Redstone, Farming, Drops"
  51. else if arg-1 is not set:
  52. send "{@prefix} &8-- &7You need a price... are you okay?"
  53. else if player's tool is not air:
  54. if arg-1 is "building" or "farming" or "redstone" or "Drops":
  55. set {_v} to "%vanilla name of tool%"
  56. replace all "minecraft:" in {_v} with ""
  57. replace all "_" in {_v} with " "
  58. send "{@prefix} &8-- &7Added &b%{_v}% &7to &b%arg-1% &7for &b$%arg-2%&7!"
  59. add "%player's tool% - %arg-2%" to {shop::%arg-1%::*}
  60. else:
  61. send "{@prefix} &8-- &7Invalid category."
  62. else:
  63. send "{@prefix} &8-- &7Please hold the item you want to add."
  64.  
  65. command /delitem [<text>] [<text>]:
  66. permission: op
  67. permission message: &cno
  68. trigger:
  69. if arg-1 is not "building" or "farming" or "redstone" or "drops":
  70. send "{@prefix} &8-- &7Categories: &bBuilding, Redstone, Farming, Drops"
  71. else if arg-1 is not set:
  72. send "{@prefix} &8-- &7Choose an item."
  73. else if {shop::%arg-1%::*} does not contain arg-2:
  74. send "{@prefix} &8- &7ITEMS IN SHOP:"
  75. loop {shop::%arg-1%::*}:
  76. send "&8- &b%loop-value%"
  77. else:
  78. remove arg-2 from {shop::%arg-1%::*}
  79. send "{@prefix} &8- &7Removed the item from shop."
  80.  
  81. function buyitem(p: player, i: item, price: number, name: text):
  82. if {bal::%{_p}%} >= {_price}:
  83. if {_p} has enough space for {_i}:
  84. give {_p} {_i}
  85. subtract {_price} from {bal::%{_p}%}
  86. send "{@prefix} &8- &7You bought &b%{_name}% &7for &b$%convertNum({_price})%&7!" to {_p}
  87. else:
  88. send "{@prefix} &8- &7You don't have enough inventory space!" to {_p}
  89. else:
  90. send "{@prefix} &8- &7You're too broke to do that!" to {_p}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement