Advertisement
TheCoolWIzard

ShopUI 1.0.2

May 7th, 2020
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.46 KB | None | 0 0
  1. cmd create shop shopUI
  2. cmd add shop onerror goto 240
  3. cmd add shop %player% = %p%
  4. cmd add shop if %args%[1] in onlineplayers() then let %player% = %args%[1]
  5. cmd add shop %ps% = playerstatus(%p%)
  6. cmd add shop if (%ps%[\"op\"] = %true%) and (%args%[1] in array(\"help\", \"category\", \"item\", \"reset\")) then goto 76
  7. cmd add shop load %shopcategories%
  8. cmd add shop if varset(%shopcategories%) = %false% then message %player% \"§b[§dShop§b] §aShop is currently under maintenance!\"
  9. cmd add shop if varset(%shopcategories%) = %false% then exit
  10. cmd add shop %size% = size(%shopcategories%)
  11. cmd add shop %num% = 0
  12. cmd add shop if %num% = %size% then goto 16
  13. cmd add shop %b%[\"text\"] = \"§0\" + %shopcategories%[%num%]
  14. cmd add shop %num% = %num% + 1
  15. cmd add shop %bs%[] = %b%
  16. cmd add shop goto 11
  17. cmd add shop %gui1%[\"type\"] = \"form\"
  18. cmd add shop %gui1%[\"title\"] = \"§b[§dShop§b]\"
  19. cmd add shop %gui1%[\"content\"] = \"Select a category\"
  20. cmd add shop %gui1%[\"buttons\"] = %bs%
  21. cmd add shop %res1% = dialog(%player%, %gui1%)
  22. cmd add shop if (%res1% = %false%) or (varset(%res1%) = %false%) then exit
  23. cmd add shop %bs2% =
  24. cmd add shop %category% = %shopcategories%[%res1%]
  25. cmd add shop %a%[\"text\"] = \"§7Go back\"
  26. cmd add shop %bs2%[] = %a%
  27. cmd add shop load %shopitems% %category%
  28. cmd add shop if varset(%shopitems%) = %false% then message %player% §b[§dShop§b] §aThat category is currently closed!
  29. cmd add shop if varset(%shopitems%) = %false% then exit
  30. cmd add shop %size% = size(%shopitems%)
  31. cmd add shop %num% = 0
  32. cmd add shop if %num% = %size% then goto 39
  33. cmd add shop %itemdata% = %shopitems%[%num%]
  34. cmd add shop %name% = %itemdata%[\"name\"]
  35. cmd add shop %price% = %itemdata%[\"price\"]
  36. cmd add shop %i2%[\"text\"] = \"§l§§\" + %name% +\"\\n§r§a$\" + %price%
  37. cmd add shop %bs2%[] = %i2%
  38. cmd add shop %num% = %num% + 1
  39. cmd add shop goto 31
  40. cmd add shop %gui2%[\"type\"] = \"form\"
  41. cmd add shop %gui2%[\"title\"] = \"§b[§dShop§b]\"
  42. cmd add shop %gui2%[\"content\"] = \"§eSelect item to buy\"
  43. cmd add shop %gui2%[\"buttons\"] = %bs2%
  44. cmd add shop %res2% = dialog(%player%, %gui2%)
  45. cmd add shop if %res2% = %false% then exit
  46. cmd add shop if %res2% = 0 then goto 20
  47. cmd add shop %res2% = int(int(%res2%) - 1)
  48. cmd add shop %item% = %shopitems%[%res2%]
  49. cmd add shop %itemname% = %item%[\"name\"]
  50. cmd add shop %itemprice% = %item%[\"price\"]
  51. cmd add shop %itemid% = %item%[\"id\"]
  52. cmd add shop %gui3%[\"type\"] = \"custom_form\"
  53. cmd add shop %gui3%[\"title\"] = \"§b[§dShop§b]\"
  54. cmd add shop %i0%[\"type\"] = \"label\"
  55. cmd add shop %i0%[\"text\"] = \"§e\" + %itemname%
  56. cmd add shop %i1%[\"type\"] = \"label\"
  57. cmd add shop %i1%[\"text\"] = \"§ePrice: §a$\" + %itemprice%
  58. cmd add shop %i2%[\"type\"] = \"slider\"
  59. cmd add shop %i2%[\"max\"] = 64
  60. cmd add shop %i2%[\"min\"] = 1
  61. cmd add shop %i2%[\"text\"] = \"§a$\" + %itemprice% + \" §7x \"
  62. cmd add shop %is%[] = %i0%
  63. cmd add shop %is%[] = %i1%
  64. cmd add shop %is%[] = %i2%
  65. cmd add shop %gui3%[\"content\"] = %is%
  66. cmd add shop %res3% = dialog(%player%, %gui3%)
  67. cmd add shop if %res3% = %false% then exit
  68. cmd add shop %qnty% = int(%res3%[2])
  69. cmd add shop %fprice% = int(%qnty%*int(%itemprice%))
  70. cmd add shop %playerbalance% = playerbalance(%player%)
  71. cmd add shop if %playerbalance% < %fprice% then message %player% §b[§dShop§b] §aYou don't have enough balance!
  72. cmd add shop if %playerbalance% < %fprice% then exit
  73. cmd add shop ascon /takemoney %player% %fprice%
  74. cmd add shop ascon /give %player% %itemid% %qnty%
  75. cmd add shop message %player% §b[§dShop§b] §aYou bought %qnty%x %itemname% for %fprice%!
  76. cmd add shop exit
  77. cmd add shop #op commands
  78. cmd add shop if %args%[1] = \"category\" then goto 82
  79. cmd add shop if %args%[1] = \"item\" then goto 132
  80. cmd add shop if %args%[1] = \"reset\" then goto 221
  81. cmd add shop if %args%[1] = \"help\" then message %p% \"§b[§dShop§b]\\n§a/shop category add <name> - §eAdd a new category\\n§a/shop category delete <name> - §eDelete a category\\n§a/shop category edit <name> - §eEdit a category\\n§a/shop item add <category> <name> <id> <price> - §eAdd an item into a category\\n§a/shop item edit <category> <name> - §eEdit an item in a category\\n§a/shop item delete <category> <name> - §eDelete an item in a category\\n§c/shop reset - §eReset the Shop\"
  82. cmd add shop exit
  83. cmd add shop #category
  84. cmd add shop if %args%[2] = \"add\" then goto 88
  85. cmd add shop if %args%[2] = \"delete\" then goto 100
  86. cmd add shop if %args%[2] = \"edit\" then goto 115
  87. cmd add shop message %p% \"§b[§dShop§b]\\n§a/shop category add [name]\\n/shop category delete [name] - this will delete items within the category aswell\\n/shop category edit [name]\"
  88. cmd add shop exit
  89. cmd add shop #add
  90. cmd add shop if varset(%args%[3]) = %false% then message %p% §eUsage: /shop category add [name]
  91. cmd add shop if varset(%args%[3]) = %false% then exit
  92. cmd add shop %category% = %args%[3]
  93. cmd add shop load %shopcategories%
  94. cmd add shop if varset(%shopcategories%) = %false% then goto 96
  95. cmd add shop if %category% in %shopcategories% then message %p% §b[§dShop§b] §aCategory name already exist!
  96. cmd add shop if %category% in %shopcategories% then exit
  97. cmd add shop %shopcategories%[] = %category%
  98. cmd add shop save %shopcategories%
  99. cmd add shop message %p% §b[§dShop§b] §aCategory added!
  100. cmd add shop exit
  101. cmd add shop #delete
  102. cmd add shop if varset(%args%[3]) = %false% then message %p% §eUsage: /shop category shop delete [name]
  103. cmd add shop if varset(%args%[3]) = %false% then exit
  104. cmd add shop %category% = %args%[3]
  105. cmd add shop load %shopcategories%
  106. cmd add shop if %category% notin %shopcategories% then message %p% §b[§dShop§b] §aCategory doesn't exist!
  107. cmd add shop if %category% notin %shopcategories% then exit
  108. cmd add shop %pos% = position(%shopcategories%, %category%)
  109. cmd add shop %shopcategories%[%pos%] =
  110. cmd add shop %shopcategories%[] =
  111. cmd add shop save %shopcategories%
  112. cmd add shop %shopitems% =
  113. cmd add shop save %shopitems% %category%
  114. cmd add shop message %p% §b[§dShop§b] §aCategory deleted!
  115. cmd add shop exit
  116. cmd add shop #edit
  117. cmd add shop if (varset(%args%[3]) = %false%) or (varset(%args%[4]) = %false%) then message %p% §eUsage: /shop category edit [name] [newname]
  118. cmd add shop if (varset(%args%[3]) = %false%) or (varset(%args%[4]) = %false%) then exit
  119. cmd add shop %oldcategory% = %args%[3]
  120. cmd add shop %newcategory% = %args%[4]
  121. cmd add shop load %shopcategories%
  122. cmd add shop if %oldcategory% notin %shopcategories% then message %p% §b[§dShop§b] §aCategory doesn't exist!
  123. cmd add shop if %oldcategory% notin %shopcategories% then exit
  124. cmd add shop %pos% = position(%shopcategories%, %oldcategory%)
  125. cmd add shop %shopcategories%[%pos%] = %newcategory%
  126. cmd add shop save %shopcategories%
  127. cmd add shop load %shopitems% %oldcategory%
  128. cmd add shop save %shopitems% %newcategory%
  129. cmd add shop %shopitems% =
  130. cmd add shop save %shopitems% %oldcategory%
  131. cmd add shop message %p% §b[§dShop§b] §aCategory edited!
  132. cmd add shop exit
  133. cmd add shop #item
  134. cmd add shop if %args%[2] = \"add\" then goto 138
  135. cmd add shop if %args%[2] = \"delete\" then goto 153
  136. cmd add shop if %args%[2] = \"edit\" then goto 174
  137. cmd add shop message %p% \"§b[§dShop§b]\\n§a/shop item add [category] [name] [price] [item id]\\n/shop item delete [category] [name]\\n/shop item edit [category] [name]\"
  138. cmd add shop exit
  139. cmd add shop #add
  140. cmd add shop if (varset(%args%[3]) = %false%) or (varset(%args%[4]) = %false%) or (varset(%args%[5]) = %false%) or (varset(%args%[6]) = %false%) then message %p% §eUsage: /shop item add [category] [name] [price] [item id]
  141. cmd add shop if (varset(%args%[3]) = %false%) or (varset(%args%[4]) = %false%) or (varset(%args%[5]) = %false%) or (varset(%args%[6]) = %false%) then exit
  142. cmd add shop %category% = %args%[3]
  143. cmd add shop load %shopcategories%
  144. cmd add shop if %category% notin %shopcategories% then message %p% §b[§dShop§b] §aCategory doesn't exist!
  145. cmd add shop if %category% notin %shopcategories% then exit
  146. cmd add shop %item%[\"name\"] = %args%[4]
  147. cmd add shop %item%[\"price\"] = %args%[5]
  148. cmd add shop %item%[\"id\"] = %args%[6]
  149. cmd add shop load %shopitems% %category%
  150. cmd add shop %shopitems%[] = %item%
  151. cmd add shop save %shopitems% %category%
  152. cmd add shop message %p% §b[§dShop§b] §aItem Saved!
  153. cmd add shop exit
  154. cmd add shop #delete
  155. cmd add shop if (varset(%args%[3]) = %false%) or (varset(%args%[4]) = %false%) then message %p% §b[§dShop§b] §eUsage: /shop item delete [category] [name]
  156. cmd add shop if (varset(%args%[3]) = %false%) or (varset(%args%[4]) = %false%) then exit
  157. cmd add shop %category% = %args%[3]
  158. cmd add shop %name% = %args%[4]
  159. cmd add shop load %shopcategories%
  160. cmd add shop if %category% notin %shopcategories% then message %p% §b[§dShop§b] §aCategory doesn't exist!
  161. cmd add shop if %category% notin %shopcategories% then exit
  162. cmd add shop load %shopitems% %category%
  163. cmd add shop %size% = size(%shopitems%)
  164. cmd add shop %size% = %size% - 1
  165. cmd add shop if %size% = -1 then message %p% §b[§dShop§b] §aItem doesn't exist!
  166. cmd add shop if %size% = -1 then exit
  167. cmd add shop %item% = %shopitems%[%size%]
  168. cmd add shop if %item%[\"name\"] = %name% then goto 169
  169. cmd add shop goto 163
  170. cmd add shop %shopitems%[%size%] =
  171. cmd add shop %shopitems%[] =
  172. cmd add shop save %shopitems% %category%
  173. cmd add shop message %p% §b[§dShop§b] §aItem deleted!
  174. cmd add shop exit
  175. cmd add shop #edit
  176. cmd add shop if (varset(%args%[3]) = %false%) or (varset(%args%[4]) = %false%) then message %p% §eUsage: /shop item edit [category] [name]
  177. cmd add shop if (varset(%args%[3]) = %false%) or (varset(%args%[4]) = %false%) then exit
  178. cmd add shop %category% = %args%[3]
  179. cmd add shop %name% = %args%[4]
  180. cmd add shop load %shopcategories%
  181. cmd add shop if %category% notin %shopcategories% then message %p% §b[§dShop§b] §aCategory doesn't exist!
  182. cmd add shop if %category% notin %shopcategories% then exit
  183. cmd add shop load %shopitems% %category%
  184. cmd add shop %size% = size(%shopitems%)
  185. cmd add shop %size% = %size% - 1
  186. cmd add shop if %size% = -1 then message %p% §b[§dShop§b] §aItem doesn't exist!
  187. cmd add shop if %size% = -1 then exit
  188. cmd add shop %item% = %shopitems%[%size%]
  189. cmd add shop if %item%[\"name\"] = %name% then goto 190
  190. cmd add shop goto 184
  191. cmd add shop %gui%[\"type\"] = \"custom_form\"
  192. cmd add shop %gui%[\"title\"] = \"§b[§dShop§b]\"
  193. cmd add shop %i0%[\"type\"] = \"label\"
  194. cmd add shop %i0%[\"text\"] = \"editing item \" + %item%[\"name\"]
  195. cmd add shop %i1%[\"type\"] = \"input\"
  196. cmd add shop %i1%[\"text\"] = \"item's name\"
  197. cmd add shop %i1%[\"placeholder\"] = \"text only\"
  198. cmd add shop %i1%[\"default\"] = %item%[\"name\"]
  199. cmd add shop %i2%[\"type\"] = \"input\"
  200. cmd add shop %i2%[\"text\"] = \"item's price\"
  201. cmd add shop %i2%[\"placeholder\"] = \"§7Ex. 10000\"
  202. cmd add shop %i2%[\"default\"] = \"\" + %item%[\"price\"] + \"\"
  203. cmd add shop %i3%[\"type\"] = \"input\"
  204. cmd add shop %i3%[\"text\"] = \"item's id\"
  205. cmd add shop %i3%[\"placeholder\"] = \"§7Ex. 17:10\"
  206. cmd add shop %i3%[\"default\"] = \"\" + %item%[\"id\"] + \"\"
  207. cmd add shop %is%[] = %i0%
  208. cmd add shop %is%[] = %i1%
  209. cmd add shop %is%[] = %i2%
  210. cmd add shop %is%[] = %i3%
  211. cmd add shop %gui%[\"content\"] = %is%
  212. cmd add shop %res% = dialog(%p%, %gui%)
  213. cmd add shop if %res% = %false% then exit
  214. cmd add shop load %shopitems%
  215. cmd add shop %newitem%[\"name\"] = %res%[1]
  216. cmd add shop %newitem%[\"price\"] = %res%[2]
  217. cmd add shop %newitem%[\"id\"] = %res%[3]
  218. cmd add shop %shopitems%[%size%] = %newitem%
  219. cmd add shop save %shopitems% %category%
  220. cmd add shop message %p% §b[§dShop§b] §aItem Edited!
  221. cmd add shop exit
  222. cmd add shop #reset
  223. cmd add shop %gui%[\"type\"] = \"modal\"
  224. cmd add shop %gui%[\"title\"] = \"§b[§dShop§b]\"
  225. cmd add shop %gui%[\"content\"] = \"§fAre you sure you want to reset the shop data?\\n§0All your categories and items added to shop will be lost.\"
  226. cmd add shop %gui%[\"button1\"] = \"§eYes\"
  227. cmd add shop %gui%[\"button2\"] = \"§7No\"
  228. cmd add shop %res% = dialog(%p%, %gui%)
  229. cmd add shop if %res% = %false% then exit
  230. cmd add shop load %shopcategories%
  231. cmd add shop %size% = size(%shopcategories%)
  232. cmd add shop %size% = %size% - 1
  233. cmd add shop if %size% = -1 then goto 237
  234. cmd add shop %category% = %shopcategories%[%size%]
  235. cmd add shop %shopitems% =
  236. cmd add shop save %shopitems% %category%
  237. cmd add shop goto 231
  238. cmd add shop %shopcategories% =
  239. cmd add shop save %shopcategories%
  240. cmd add shop message %p% §b[§dShop§b] §aShop data has been reset!
  241. cmd add shop exit
  242. cmd add shop #1.0.2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement