Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.18 KB | None | 0 0
  1. aliases:
  2. lime stained glass = 95:5
  3. yellow stained glass = 95:4
  4. red wool = 35:14
  5. lime wool = 35:5
  6. barrier = 166:0
  7.  
  8. function nf(i: number) :: text:
  9. if {_i} is less than 1000:
  10. return "%floor({_i} * 1000) / 1000%"
  11. else:
  12. if {_i} is less than 1000000:
  13. return "%floor({_i}) / 1000%K"
  14. else:
  15. if {_i} is less than 1000000000:
  16. return "%floor({_i} / 1000) / 1000%M"
  17. else:
  18. if {_i} is less than 1000000000000:
  19. return "%floor({_i} / 1000000) / 1000%B"
  20. else:
  21. if {_i} is less than 1000000000000000:
  22. return "%floor({_i} / 1000000000) / 1000%T"
  23. else:
  24. if {_i} is less than 1000000000000000000:
  25. return "%floor({_i} / 1000000000000) / 1000%Q"
  26. else:
  27. return "%floor({_i} / 1000000000000000) / 1000%Qu"
  28.  
  29. function incprice(l: location, t: text, a: number, p: player) :: text:
  30. if {_t} is "buy":
  31. add {_a} to {zmcsignshop.%{_l}%.buyprice}
  32. if {zmcsignshop.%{_l}%.buyprice} is less than 0:
  33. set {zmcsignshop.%{_l}%.buyprice} to 0
  34. make gui slot 3 of {_p} with paper named "&aBuy price: $%nf({zmcsignshop.%{_l}%.buyprice})%"
  35. else:
  36. add {_a} to {zmcsignshop.%{_l}%.sellprice}
  37. if {zmcsignshop.%{_l}%.sellprice} is less than 0:
  38. set {zmcsignshop.%{_l}%.sellprice} to 0
  39. make gui slot 3 of {_p} with paper named "&eSell price: $%nf({zmcsignshop.%{_l}%.sellprice})%"
  40.  
  41. function buypricegui(p: player, l: location) :: text:
  42. open virtual chest inventory with size 6 named "&aEdit Buy Price" to {_p}
  43. create a gui slot 3 of {_p} with paper named "&aBuy price: $%nf({zmcsignshop.%{_l}%.buyprice})%" to do nothing
  44. if {zmcsignshop.%{_l}%.item} is air:
  45. create a gui slot 4 of {_p} with barrier named "&4No shop item set!" to do nothing
  46. else:
  47. create a gui slot 4 of {_p} with {zmcsignshop.%{_l}%.item} to do nothing
  48.  
  49. make gui slot 18 of {_p} with lime stained glass named "&a+$0.01" to run function incprice({_l}, "buy", 0.01, {_p})
  50. make gui slot 27 of {_p} with lime stained glass named "&a-$0.01" to run function incprice({_l}, "buy", -0.01, {_p})
  51.  
  52. make gui slot 19 of {_p} with lime stained glass named "&a+$0.1" to run function incprice({_l}, "buy", 0.1, {_p})
  53. make gui slot 28 of {_p} with lime stained glass named "&a-$0.1" to run function incprice({_l}, "buy", -0.1, {_p})
  54.  
  55. make gui slot 20 of {_p} with lime stained glass named "&a+$1" to run function incprice({_l}, "buy", 1, {_p})
  56. make gui slot 29 of {_p} with lime stained glass named "&a-$1" to run function incprice({_l}, "buy", -1, {_p})
  57.  
  58. make gui slot 21 of {_p} with lime stained glass named "&a+$10" to run function incprice({_l}, "buy", 10, {_p})
  59. make gui slot 30 of {_p} with lime stained glass named "&a-$10" to run function incprice({_l}, "buy", -10, {_p})
  60.  
  61. make gui slot 22 of {_p} with lime stained glass named "&a+$100" to run function incprice({_l}, "buy", 100, {_p})
  62. make gui slot 31 of {_p} with lime stained glass named "&a-$100" to run function incprice({_l}, "buy", -100, {_p})
  63.  
  64. make gui slot 23 of {_p} with lime stained glass named "&a+$1K" to run function incprice({_l}, "buy", 1000, {_p})
  65. make gui slot 32 of {_p} with lime stained glass named "&a-$1K" to run function incprice({_l}, "buy", -1000, {_p})
  66.  
  67. make gui slot 24 of {_p} with lime stained glass named "&a+$10K" to run function incprice({_l}, "buy", 10000, {_p})
  68. make gui slot 33 of {_p} with lime stained glass named "&a-$10K" to run function incprice({_l}, "buy", -10000, {_p})
  69.  
  70. make gui slot 25 of {_p} with lime stained glass named "&a+$100K" to run function incprice({_l}, "buy", 100000, {_p})
  71. make gui slot 34 of {_p} with lime stained glass named "&a-$100K" to run function incprice({_l}, "buy", -100000, {_p})
  72.  
  73. make gui slot 26 of {_p} with lime stained glass named "&a+$1M" to run function incprice({_l}, "buy", 1000000, {_p})
  74. make gui slot 35 of {_p} with lime stained glass named "&a-$1M" to run function incprice({_l}, "buy", -1000000, {_p})
  75.  
  76. make gui slot 36 of {_p} with lime stained glass named "&a+$10M" to run function incprice({_l}, "buy", 10000000, {_p})
  77. make gui slot 45 of {_p} with lime stained glass named "&a-$10M" to run function incprice({_l}, "buy", -10000000, {_p})
  78.  
  79. make gui slot 37 of {_p} with lime stained glass named "&a+$100M" to run function incprice({_l}, "buy", 100000000, {_p})
  80. make gui slot 46 of {_p} with lime stained glass named "&a-$100M" to run function incprice({_l}, "buy", -100000000, {_p})
  81.  
  82. make gui slot 38 of {_p} with lime stained glass named "&a+$1B" to run function incprice({_l}, "buy", 1000000000, {_p})
  83. make gui slot 47 of {_p} with lime stained glass named "&a-$1B" to run function incprice({_l}, "buy", -1000000000, {_p})
  84.  
  85. make gui slot 39 of {_p} with lime stained glass named "&a+$10B" to run function incprice({_l}, "buy", 10000000000, {_p})
  86. make gui slot 48 of {_p} with lime stained glass named "&a-$10B" to run function incprice({_l}, "buy", -10000000000, {_p})
  87.  
  88. make gui slot 40 of {_p} with lime stained glass named "&a+$100B" to run function incprice({_l}, "buy", 100000000000, {_p})
  89. make gui slot 49 of {_p} with lime stained glass named "&a-$100B" to run function incprice({_l}, "buy", -100000000000, {_p})
  90.  
  91. make gui slot 41 of {_p} with lime stained glass named "&a+$1T" to run function incprice({_l}, "buy", 1000000000000, {_p})
  92. make gui slot 50 of {_p} with lime stained glass named "&a-$1T" to run function incprice({_l}, "buy", -1000000000000, {_p})
  93.  
  94. make gui slot 42 of {_p} with lime stained glass named "&a+$10T" to run function incprice({_l}, "buy", 10000000000000, {_p})
  95. make gui slot 51 of {_p} with lime stained glass named "&a-$10T" to run function incprice({_l}, "buy", -10000000000000, {_p})
  96.  
  97. make gui slot 43 of {_p} with lime stained glass named "&a+$100T" to run function incprice({_l}, "buy", 100000000000000, {_p})
  98. make gui slot 52 of {_p} with lime stained glass named "&a-$100T" to run function incprice({_l}, "buy", -100000000000000, {_p})
  99.  
  100. make gui slot 44 of {_p} with lime stained glass named "&a+$1Q" to run function incprice({_l}, "buy", 1000000000000000, {_p})
  101. make gui slot 53 of {_p} with lime stained glass named "&a-$1Q" to run function incprice({_l}, "buy", -1000000000000000, {_p})
  102.  
  103. function sellpricegui(p: player, l: location) :: text:
  104. open virtual chest inventory with size 6 named "&eEdit Sell Price" to {_p}
  105. create a gui slot 3 of {_p} with paper named "&eSell price: $%nf({zmcsignshop.%{_l}%.sellprice})%" to do nothing
  106. if {zmcsignshop.%{_l}%.item} is air:
  107. create a gui slot 4 of {_p} with barrier named "&4No shop item set!" to do nothing
  108. else:
  109. create a gui slot 4 of {_p} with {zmcsignshop.%{_l}%.item} to do nothing
  110.  
  111. make gui slot 18 of {_p} with yellow stained glass named "&e+$0.01" to run function incprice({_l}, "sell", 0.01, {_p})
  112. make gui slot 27 of {_p} with yellow stained glass named "&e-$0.01" to run function incprice({_l}, "sell", -0.01, {_p})
  113.  
  114. make gui slot 19 of {_p} with yellow stained glass named "&e+$0.1" to run function incprice({_l}, "sell", 0.1, {_p})
  115. make gui slot 28 of {_p} with yellow stained glass named "&e-$0.1" to run function incprice({_l}, "sell", -0.1, {_p})
  116.  
  117. make gui slot 20 of {_p} with yellow stained glass named "&e+$1" to run function incprice({_l}, "sell", 1, {_p})
  118. make gui slot 29 of {_p} with yellow stained glass named "&e-$1" to run function incprice({_l}, "sell", -1, {_p})
  119.  
  120. make gui slot 21 of {_p} with yellow stained glass named "&e+$10" to run function incprice({_l}, "sell", 10, {_p})
  121. make gui slot 30 of {_p} with yellow stained glass named "&e-$10" to run function incprice({_l}, "sell", -10, {_p})
  122.  
  123. make gui slot 22 of {_p} with yellow stained glass named "&e+$100" to run function incprice({_l}, "sell", 100, {_p})
  124. make gui slot 31 of {_p} with yellow stained glass named "&e-$100" to run function incprice({_l}, "sell", -100, {_p})
  125.  
  126. make gui slot 23 of {_p} with yellow stained glass named "&e+$1K" to run function incprice({_l}, "sell", 1000, {_p})
  127. make gui slot 32 of {_p} with yellow stained glass named "&e-$1K" to run function incprice({_l}, "sell", -1000, {_p})
  128.  
  129. make gui slot 24 of {_p} with yellow stained glass named "&e+$10K" to run function incprice({_l}, "sell", 10000, {_p})
  130. make gui slot 33 of {_p} with yellow stained glass named "&e-$10K" to run function incprice({_l}, "sell", -10000, {_p})
  131.  
  132. make gui slot 25 of {_p} with yellow stained glass named "&e+$100K" to run function incprice({_l}, "sell", 100000, {_p})
  133. make gui slot 34 of {_p} with yellow stained glass named "&e-$100K" to run function incprice({_l}, "sell", -100000, {_p})
  134.  
  135. make gui slot 26 of {_p} with yellow stained glass named "&e+$1M" to run function incprice({_l}, "sell", 1000000, {_p})
  136. make gui slot 35 of {_p} with yellow stained glass named "&e-$1M" to run function incprice({_l}, "sell", -1000000, {_p})
  137.  
  138. make gui slot 36 of {_p} with yellow stained glass named "&e+$10M" to run function incprice({_l}, "sell", 10000000, {_p})
  139. make gui slot 45 of {_p} with yellow stained glass named "&e-$10M" to run function incprice({_l}, "sell", -10000000, {_p})
  140.  
  141. make gui slot 37 of {_p} with yellow stained glass named "&e+$100M" to run function incprice({_l}, "sell", 100000000, {_p})
  142. make gui slot 46 of {_p} with yellow stained glass named "&e-$100M" to run function incprice({_l}, "sell", -100000000, {_p})
  143.  
  144. make gui slot 38 of {_p} with yellow stained glass named "&e+$1B" to run function incprice({_l}, "sell", 1000000000, {_p})
  145. make gui slot 47 of {_p} with yellow stained glass named "&e-$1B" to run function incprice({_l}, "sell", -1000000000, {_p})
  146.  
  147. make gui slot 39 of {_p} with yellow stained glass named "&e+$10B" to run function incprice({_l}, "sell", 10000000000, {_p})
  148. make gui slot 48 of {_p} with yellow stained glass named "&e-$10B" to run function incprice({_l}, "sell", -10000000000, {_p})
  149.  
  150. make gui slot 40 of {_p} with yellow stained glass named "&e+$100B" to run function incprice({_l}, "sell", 100000000000, {_p})
  151. make gui slot 49 of {_p} with yellow stained glass named "&e-$100B" to run function incprice({_l}, "sell", -100000000000, {_p})
  152.  
  153. make gui slot 41 of {_p} with yellow stained glass named "&e+$1T" to run function incprice({_l}, "sell", 1000000000000, {_p})
  154. make gui slot 50 of {_p} with yellow stained glass named "&e-$1T" to run function incprice({_l}, "sell", -1000000000000, {_p})
  155.  
  156. make gui slot 42 of {_p} with yellow stained glass named "&e+$10T" to run function incprice({_l}, "sell", 10000000000000, {_p})
  157. make gui slot 51 of {_p} with yellow stained glass named "&e-$10T" to run function incprice({_l}, "sell", -10000000000000, {_p})
  158.  
  159. make gui slot 43 of {_p} with yellow stained glass named "&e+$100T" to run function incprice({_l}, "sell", 100000000000000, {_p})
  160. make gui slot 52 of {_p} with yellow stained glass named "&e-$100T" to run function incprice({_l}, "sell", -100000000000000, {_p})
  161.  
  162. make gui slot 44 of {_p} with yellow stained glass named "&e+$1Q" to run function incprice({_l}, "sell", 1000000000000000, {_p})
  163. make gui slot 53 of {_p} with yellow stained glass named "&e-$1Q" to run function incprice({_l}, "sell", -1000000000000000, {_p})
  164.  
  165. function itemCount(p: player, i: item type) :: number:
  166. set {_c} to 0
  167. loop all items in {_p}'s inventory:
  168. if loop-item is {_i}:
  169. add amount of item loop-item to {_c}
  170. return {_c}
  171.  
  172. function removeItem(p: player, i: item type, a: number) :: text:
  173. set {_c} to {_a}
  174. loop all items in {_p}'s inventory:
  175. if {_c} > 0:
  176. if loop-item is {_i}:
  177. set {_r} to amount of item loop-item
  178. if {_r} is greater than {_c}:
  179. set {_r} to {_c}
  180. subtract {_r} from {_c}
  181. set {_r} to amount of item loop-item - {_r}
  182. set {_j} to 1 of loop-item
  183. set loop-item to {_r} of {_j}
  184.  
  185. function stockslots(p: player, l: location) :: text:
  186. set {_s} to 3
  187. set {_i} to paper named "&9Stock: %{zmcsignshop.%{_l}%.instock}%"
  188. set line 1 of {_i}'s lore to "&9Click on the glass to change stock!"
  189. loop 6 times:
  190. create a gui slot {_s} of {_p} with {_i} to do nothing
  191. create a gui slot {_s} + 2 of {_p} with {_i} to do nothing
  192. add 9 to {_s}
  193.  
  194. function canhold(p: player, i: item type) :: number:
  195. set {_c} to 0
  196. while {_p} has space for {_c} of {_i}:
  197. add 100 to {_c}
  198. subtract 100 from {_c}
  199. while {_p} has space for {_c} of {_i}:
  200. add 10 to {_c}
  201. subtract 10 from {_c}
  202. while {_p} has space for {_c} of {_i}:
  203. add 1 to {_c}
  204. subtract 1 from {_c}
  205. return {_c}
  206.  
  207. function dorestock(p: player, l: location, a: integer, t: text) :: text:
  208. if {zmcsignshop.%{_l}%.item} is not air:
  209. if {_t} is "give":
  210. set {_b} to {_a}
  211. if itemCount({_p}, {zmcsignshop.%{_l}%.item}) < {_b}:
  212. set {_b} to itemCount({_p}, {zmcsignshop.%{_l}%.item})
  213. if 2000 - {zmcsignshop.%{_l}%.instock} < {_b}:
  214. set {_b} to (2000 - {zmcsignshop.%{_l}%.instock})
  215. if {_b} > 0:
  216. if itemCount({_p}, {zmcsignshop.%{_l}%.item}) >= {_b}:
  217. removeItem({_p}, {zmcsignshop.%{_l}%.item}, {_b})
  218. add {_b} to {zmcsignshop.%{_l}%.instock}
  219. else:
  220. send "&cNot enough items!" to {_p}
  221. else:
  222. send "&cShop is full of items!" to {_p}
  223. else:
  224. set {_b} to {_a}
  225. if {_b} > {zmcsignshop.%{_l}%.instock}:
  226. set {_b} to {zmcsignshop.%{_l}%.instock}
  227. if {_b} > canhold({_p}, {zmcsignshop.%{_l}%.item}):
  228. set {_b} to canhold({_p}, {zmcsignshop.%{_l}%.item})
  229. if {_b} > 0:
  230. if {_p} has space for {_b} of {zmcsignshop.%{_l}%.item}:
  231. give {_p} {_b} of {zmcsignshop.%{_l}%.item}
  232. subtract {_b} from {zmcsignshop.%{_l}%.instock}
  233. else:
  234. send "&cNot enough inventory space!" to {_p}
  235. else:
  236. send "&cShop doesn't have enough itens!" to {_p}
  237. stockslots({_p}, {_l})
  238.  
  239. function restockslots(p: player, l: location, a: integer, i: integer, t: text) :: text:
  240. set {_j} to cobblestone
  241. if {_t} is "give":
  242. set {_j} to yellow stained glass named "&ePut in &l%{_a}%&e item(s)"
  243. else:
  244. set {_j} to lime stained glass named "&aTake out &l%{_a}%&a item(s)"
  245. create a gui slot {_i} of {_p} with {_j} to run function dorestock({_p}, {_l}, {_a}, {_t})
  246. create a gui slot {_i} + 1 of {_p} with {_j} to run function dorestock({_p}, {_l}, {_a}, {_t})
  247. create a gui slot {_i} + 2 of {_p} with {_j} to run function dorestock({_p}, {_l}, {_a}, {_t})
  248.  
  249. function restock(p: player, l: location) :: text:
  250. open virtual chest inventory with size 6 named "&9Restock Shop" to {_p}
  251. if {zmcsignshop.%{_l}%.item} is air:
  252. create a gui slot 4 of {_p} with barrier named "&4No shop item set!" to do nothing
  253. else:
  254. create a gui slot 4 of {_p} with {zmcsignshop.%{_l}%.item} to do nothing
  255. stockslots({_p}, {_l})
  256. restockslots({_p}, {_l}, 1, 0, "take")
  257. restockslots({_p}, {_l}, 1, 6, "give")
  258. restockslots({_p}, {_l}, 2, 9, "take")
  259. restockslots({_p}, {_l}, 2, 15, "give")
  260. restockslots({_p}, {_l}, 5, 18, "take")
  261. restockslots({_p}, {_l}, 5, 24, "give")
  262. restockslots({_p}, {_l}, 16, 27, "take")
  263. restockslots({_p}, {_l}, 16, 33, "give")
  264. restockslots({_p}, {_l}, 64, 36, "take")
  265. restockslots({_p}, {_l}, 64, 42, "give")
  266. restockslots({_p}, {_l}, 256, 45, "take")
  267. restockslots({_p}, {_l}, 256, 51, "give")
  268.  
  269. on sign change:
  270. if line 1 is "[Shop]":
  271. set line 1 to "&a[Shop]"
  272. set {zmcsignshop.%position of block%.set} to 1
  273. set {zmcsignshop.%position of block%.owner} to player
  274. set {zmcsignshop.%position of block%.buyprice} to 0
  275. set {zmcsignshop.%position of block%.sellprice} to 0
  276. set {zmcsignshop.%position of block%.item} to air
  277. set {zmcsignshop.%position of block%.instock} to 0
  278. set {zmcsignshop.%position of block%.enabled} to 0
  279. set {zmcsignshop.%position of block%.messages} to 1
  280. message "&8» &7You've created a shop" to player
  281.  
  282. function togenabled(p: player, l: location) :: text:
  283. if {zmcsignshop.%{_l}%.enabled} is 1:
  284. set {zmcsignshop.%{_l}%.enabled} to 0
  285. make gui slot 14 of {_p} with red wool named "&4Shop disabled! (Click to toggle)" to run function togenabled({_p}, {_l})
  286. else:
  287. set {zmcsignshop.%{_l}%.enabled} to 1
  288. make gui slot 14 of {_p} with lime wool named "&aShop enabled! (Click to toggle)" to run function togenabled({_p}, {_l})
  289.  
  290. function togmsg(p: player, l: location) :: text:
  291. if {zmcsignshop.%{_l}%.messages} is 1:
  292. set {zmcsignshop.%{_l}%.messages} to 0
  293. make gui slot 15 of {_p} with red wool named "&cMessages disabled!&7 (Click to toggle)" to run function togmsg({_p}, {_l})
  294. else:
  295. set {zmcsignshop.%{_l}%.messages} to 1
  296. make gui slot 15 of {_p} with lime wool named "&aMessages enabled!&7 (Click to toggle)" to run function togmsg({_p}, {_l})
  297.  
  298. function shopslots(p: player, l: location) :: text:
  299. set {_s} to 3
  300. set {_i} to paper named "&8» &7This shop's stock&8:&7 %{zmcsignshop.%{_l}%.instock}% item(s)"
  301. set line 1 of {_i}'s lore to "&7"
  302. set line 2 of {_i}'s lore to "&7You can only buy from"
  303. set line 3 of {_i}'s lore to "&7here while it has stock!"
  304. set line 4 of {_i}'s lore to "&7"
  305. loop 6 times:
  306. create a gui slot {_s} of {_p} with {_i} to do nothing
  307. create a gui slot {_s} + 2 of {_p} with {_i} to do nothing
  308. add 9 to {_s}
  309.  
  310. function dobuy(p: player, l: location, a: integer, t: text) :: text:
  311. if {zmcsignshop.%{_l}%.item} is not air:
  312. if {_t} is "sell":
  313. set {_b} to {_a}
  314. if itemCount({_p}, {zmcsignshop.%{_l}%.item}) < {_b}:
  315. set {_b} to itemCount({_p}, {zmcsignshop.%{_l}%.item})
  316. if {_b} <= 0:
  317. send "&cYou don't have any items!" to {_p}
  318. if 2000 - {zmcsignshop.%{_l}%.instock} < {_b}:
  319. set {_b} to 2000 - {zmcsignshop.%{_l}%.instock}
  320. if {_b} <= 0:
  321. send "&cThis shop is full!" to {_p}
  322. if {_b} > 0:
  323. if itemCount({_p}, {zmcsignshop.%{_l}%.item}) >= {_b}:
  324. if {zmcsignshop.%{_l}%.owner}'s balance >= {zmcss-pd.%{_p}%.sellprice}:
  325. removeItem({_p}, {zmcsignshop.%{_l}%.item}, {_b})
  326. add {_b} to {zmcsignshop.%{_l}%.instock}
  327. execute console command "/eco give %{_p}% %{zmcss-pd.%{_p}%.sellprice} * {_b}%"
  328. execute console command "/eco take %{zmcsignshop.%{_l}%.owner}% %{zmcss-pd.%{_p}%.sellprice} * {_b}%"
  329. if {zmcsignshop.%{_l}%.messages} = 1:
  330. send "&8» &7%{_p}% has sold %{_b}% of %{zmcsignshop.%{_l}%.item}'s display name%&7 to your shop!" to {zmcsignshop.%{_l}%.owner}
  331. else:
  332. send "&8» &7The shop owner doesn't have enough money!" to {_p}
  333. else:
  334. send "&8» &7This shop is empty!" to {_p}
  335. else:
  336. set {_b} to {_a}
  337. if {_b} > {zmcsignshop.%{_l}%.instock}:
  338. set {_b} to {zmcsignshop.%{_l}%.instock}
  339. if {_b} <= 0:
  340. send "&cThis shop is empty!" to {_p}
  341. if {_b} > canhold({_p}, {zmcsignshop.%{_l}%.item}):
  342. set {_b} to canhold({_p}, {zmcsignshop.%{_l}%.item})
  343. if {_b} <= 0:
  344. send "&8» &7You don't have enough space for anything!" to {_p}
  345. if {_b} > 0:
  346. if {_p} has space for {_b} of {zmcsignshop.%{_l}%.item}:
  347. if {_p}'s balance >= {zmcss-pd.%{_p}%.buyprice}:
  348. give {_p} {_b} of {zmcsignshop.%{_l}%.item}
  349. subtract {_b} from {zmcsignshop.%{_l}%.instock}
  350. execute console command "/eco take %{_p}% %{zmcss-pd.%{_p}%.buyprice} * {_b}%"
  351. execute console command "/eco give %{zmcsignshop.%{_l}%.owner}% %{zmcss-pd.%{_p}%.buyprice} * {_b}%"
  352. if {zmcsignshop.%{_l}%.messages} = 1:
  353. send "&8» &7%{_p}% has bought %{_b}% of %{zmcsignshop.%{_l}%.item}'s display name% from your shop!" to {zmcsignshop.%{_l}%.owner}
  354. else:
  355. send "&8» &7You don't have enough money to buy that!" to {_p}
  356. else:
  357. send "&8» &7You don't have enough inventory space!" to {_p}
  358. shopslots({_p}, {_l})
  359.  
  360. function addbuyitems(p: player, l: location, a: integer, i: integer, t: text) :: text:
  361. set {_j} to cobblestone
  362. set {_e} to 0
  363. if {_t} is "buy":
  364. if {zmcsignshop.%{_l}%.buyprice} > 0:
  365. set {_j} to yellow stained glass named "&aBuy&7 %{_a}% item(s)"
  366. set line 1 of {_j}'s lore to "&7"
  367. set line 2 of {_j}'s lore to "&7$%nf({zmcsignshop.%{_l}%.buyprice} * {_a})%"
  368. set line 3 of {_j}'s lore to "&7"
  369. set {_e} to 1
  370. else:
  371. set {_j} to red wool named "&8"
  372. else:
  373. if {zmcsignshop.%{_l}%.sellprice} > 0:
  374. set {_j} to lime stained glass named "&aSell %{_a}% item(s)"
  375. set line 1 of {_j}'s lore to "&aPrice: $%nf({zmcsignshop.%{_l}%.sellprice} * {_a})%"
  376. set {_e} to 1
  377. else:
  378. set {_j} to red wool named "&cSelling is disabled at this shop!"
  379. if {_e} is 1:
  380. create a gui slot {_i} of {_p} with {_j} to run function dobuy({_p}, {_l}, {_a}, {_t})
  381. create a gui slot {_i} + 1 of {_p} with {_j} to run function dobuy({_p}, {_l}, {_a}, {_t})
  382. create a gui slot {_i} + 2 of {_p} with {_j} to run function dobuy({_p}, {_l}, {_a}, {_t})
  383. else:
  384. create a gui slot {_i} of {_p} with {_j} to do nothing
  385. create a gui slot {_i} + 1 of {_p} with {_j} to do nothing
  386. create a gui slot {_i} + 2 of {_p} with {_j} to do nothing
  387.  
  388. on rightclick on sign:
  389. set {_ci} to stick named "&7Shop Copy Wand"
  390. set line 1 of {_ci}'s lore to "&e"
  391. set line 2 of {_ci}'s lore to "&7Shift + left click: Paste shop data"
  392. set line 3 of {_ci}'s lore to "&7Shift + right click: Copy shop data"
  393. set line 4 of {_ci}'s lore to "&e"
  394. set {_copy} to 0
  395. if player is sneaking:
  396. if player's tool is {_ci}:
  397. set {_copy} to 1
  398. if line 1 of block is "&a[Shop]":
  399. if {zmcsignshop.%position of block%.set} is set:
  400. if {zmcsignshop.%position of block%.owner} is player:
  401. if {_copy} is 0:
  402. open virtual chest inventory with size 3 named "&1Shop Settings" to player
  403. if {zmcsignshop.%position of block%.item} is air:
  404. create a gui slot 10 of player with barrier named "&4No shop item set!" to do nothing
  405. else:
  406. create a gui slot 10 of player with {zmcsignshop.%position of block%.item} to do nothing
  407. set {_i} to lime stained glass named "&aSet player buy price"
  408. set line 1 of {_i}'s lore to "&cCurrent &8» &7$%nf({zmcsignshop.%position of block%.buyprice})%"
  409. set line 2 of {_i}'s lore to "&7Set this value to"
  410. set line 3 of {_i}'s lore to "&7$0 to disable buying"
  411. set line 4 of {_i}'s lore to "&7from this shop."
  412. create a gui slot 12 of player with {_i} to run function buypricegui(player, location of block)
  413. set {_i} to yellow stained glass named "&cSet player sell price"
  414. set line 1 of {_i}'s lore to "&cCurrent &8»&7 $%nf({zmcsignshop.%position of block%.sellprice})%"
  415. set line 2 of {_i}'s lore to "&7Set this value to"
  416. set line 3 of {_i}'s lore to "&7$0 to disable selling"
  417. set line 4 of {_i}'s lore to "&7to this shop."
  418. create a gui slot 13 of player with {_i} to run function sellpricegui(player, location of block)
  419. if {zmcsignshop.%position of block%.enabled} is 0:
  420. make gui slot 14 of player with red wool named "&4Shop disabled!&7 (Click to toggle)" to run function togenabled(player, position of block)
  421. else:
  422. make gui slot 14 of player with lime wool named "&aShop enabled!&7 (Click to toggle)" to run function togenabled(player, position of block)
  423. if {zmcsignshop.%position of block%.messages} is 0:
  424. make gui slot 15 of player with red wool named "&cMessages disabled!&7 (Click to toggle)" to run function togmsg(player, position of block)
  425. else:
  426. make gui slot 15 of player with lime wool named "&aMessages enabled!&7 (Click to toggle)" to run function togmsg(player, position of block)
  427. make gui slot 16 of player with paper named "&cShop stock&7 (Click to add/remove items)" to run function restock(player, position of block)
  428. else:
  429. set {zmcss-pd.%player%.clp.buyprice} to {zmcsignshop.%position of block%.buyprice}
  430. set {zmcss-pd.%player%.clp.sellprice} to {zmcsignshop.%position of block%.sellprice}
  431. set {zmcss-pd.%player%.clp.item} to {zmcsignshop.%position of block%.item}
  432. set {zmcss-pd.%player%.clp.messages} to {zmcsignshop.%position of block%.messages}
  433. send "&eShop data copied to clipboard!"
  434. else:
  435. if {zmcsignshop.%position of block%.enabled} is 1:
  436. if {zmcsignshop.%position of block%.item} is not air:
  437. open virtual chest inventory with size 6 named "&cShop" to player
  438. create a gui slot 4 of player with {zmcsignshop.%position of block%.item} to do nothing
  439. shopslots(player, position of block)
  440. addbuyitems(player, position of block, 1, 0, "buy")
  441. addbuyitems(player, position of block, 1, 6, "sell")
  442. addbuyitems(player, position of block, 2, 9, "buy")
  443. addbuyitems(player, position of block, 2, 15, "sell")
  444. addbuyitems(player, position of block, 5, 18, "buy")
  445. addbuyitems(player, position of block, 5, 24, "sell")
  446. addbuyitems(player, position of block, 16, 27, "buy")
  447. addbuyitems(player, position of block, 16, 33, "sell")
  448. addbuyitems(player, position of block, 64, 36, "buy")
  449. addbuyitems(player, position of block, 64, 42, "sell")
  450. addbuyitems(player, position of block, 256, 45, "buy")
  451. addbuyitems(player, position of block, 256, 51, "sell")
  452. set {zmcss-pd.%player%.buyprice} to {zmcsignshop.%position of block%.buyprice}
  453. set {zmcss-pd.%player%.sellprice} to {zmcsignshop.%position of block%.sellprice}
  454. else:
  455. send "&8» &7This shop doesn't have an item set!"
  456. else:
  457. send "&8» &7This shop isn't enabled!"
  458.  
  459. on player join:
  460. delete {zmcss-pd.%player%.clp.buyprice}
  461. delete {zmcss-pd.%player%.clp.sellprice}
  462. delete {zmcss-pd.%player%.clp.item}
  463. delete {zmcss-pd.%player%.clp.messages}
  464.  
  465. on leftclick on sign:
  466. set {_ci} to stick named "&7Shop Copy Wand"
  467. set line 1 of {_ci}'s lore to "&e"
  468. set line 2 of {_ci}'s lore to "&eShift + left click: Paste shop data"
  469. set line 3 of {_ci}'s lore to "&eShift + right click: Copy shop data"
  470. set line 4 of {_ci}'s lore to "&e"
  471. set {_copy} to 0
  472. if player is sneaking:
  473. if player's tool is {_ci}:
  474. set {_copy} to 1
  475. if line 1 of block is "&a[Shop]":
  476. if {zmcsignshop.%position of block%.set} is set:
  477. if {zmcsignshop.%position of block%.owner} is player:
  478. if {_copy} is 1:
  479. if {zmcsignshop.%position of block%.instock} is 0:
  480. set {zmcsignshop.%position of block%.buyprice} to {zmcss-pd.%player%.clp.buyprice}
  481. set {zmcsignshop.%position of block%.sellprice} to {zmcss-pd.%player%.clp.sellprice}
  482. set {zmcsignshop.%position of block%.item} to {zmcss-pd.%player%.clp.item}
  483. set {zmcsignshop.%position of block%.messages} to {zmcss-pd.%player%.clp.messages}
  484. message "&8» &7Shop data was pasted." to player
  485. else:
  486. message "&8» &7Remove all of the items from the shop stock to paste shop data." to player
  487. else:
  488. if player's tool is not air:
  489. if {zmcsignshop.%position of block%.instock} is 0:
  490. set {zmcsignshop.%position of block%.item} to 1 of player's tool
  491. message "&8» &7Shop item changed to the item in your hand." to player
  492. else:
  493. message "&8» &7Remove all of the items from the shop stock to change the shop item." to player
  494.  
  495. on break of sign:
  496. if {zmcsignshop.%position of block%.set} is set:
  497. if {zmcsignshop.%position of block%.owner} is player:
  498. if {zmcsignshop.%position of block%.instock} = 0:
  499. delete {zmcsignshop.%position of block%.set}
  500. delete {zmcsignshop.%position of block%.owner}
  501. delete {zmcsignshop.%position of block%.buyprice}
  502. delete {zmcsignshop.%position of block%.sellprice}
  503. delete {zmcsignshop.%position of block%.item}
  504. delete {zmcsignshop.%position of block%.instock}
  505. delete {zmcsignshop.%position of block%.enabled}
  506. delete {zmcsignshop.%position of block%.messages}
  507. send "&8» &7Shop destroyed!" to player
  508. else:
  509. cancel event
  510. message "&8» &7Remove all the items from this shop to destroy it." to player
  511. else:
  512. cancel event
  513. message "&8» &7This is not your shop! You cannot destroy it!" to player
  514.  
  515. command /playershop [<text>] [<text>] [<text>]:
  516. trigger:
  517. set {_pl} to "%sender%" parsed as player
  518. if arg 1 is not set:
  519. set {_p} to 0
  520. send "&cSubcommands of /playershop" to sender
  521. send "&8-----" to sender
  522. if {_pl} has permission "playershop.item":
  523. send "&8» &7/playershop item&e: Gives you an item that is related to the shop system." to sender
  524. set {_p} to 1
  525. if {_p} is 0:
  526. send "&8» &7You don't have permission for any of the subcommands of /playershop. Let a staff member know if you think that this is a mistake." to sender
  527. else:
  528. if arg 1 is "item":
  529. if {_pl} has permission "playershop.item":
  530. if arg 2 is not set:
  531. set {_p} to 0
  532. send "&eSubcommands of /playershop item" to sender
  533. send "&7-----" to sender
  534. if {_pl} has permission "playershop.item.copywand":
  535. send "&8» &7/playershop item copywand&e: Gives you a shop copy wand. This allows you to copy shop data from one shop to another." to sender
  536. set {_p} to 1
  537. if {_p} is 0:
  538. send "&8» &7You don't have permission for any of the subcommands of /playershop item. Let a staff member know if you think that this is a mistake." to sender
  539. if arg 2 is "copywand":
  540. set {_i} to stick named "&7Shop Copy Wand"
  541. set line 1 of {_i}'s lore to "&e"
  542. set line 2 of {_i}'s lore to "&eShift + left click to Paste shop data"
  543. set line 3 of {_i}'s lore to "&eShift + right click to Copy shop data"
  544. set line 4 of {_i}'s lore to "&e"
  545. give {_i} to {_pl}
  546. else:
  547. send "&8» &7You don't have permission for this command!" to sender
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement