krzysek

Shopify

Dec 3rd, 2014
419
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.48 KB | None | 0 0
  1.  
  2. # SHOPIFY - BOUGHT AND SALE ! #
  3.  
  4. #--------------////////////////-------------#
  5. # #
  6. # Shopify - it's script to solding or #
  7. # buying items by signs. #
  8. # #
  9. # Dependencies: #
  10. # - Skript 2.0.2 (or better) #
  11. # - plugin to economy #
  12. # iConomy is best :P #
  13. # #
  14. # Sign example: #
  15. # #
  16. # Line 1: _shopify #
  17. # Line 2: buy #
  18. # Line 3: *item #
  19. # Line 4: *price #
  20. # #
  21. # * - you must change it. #
  22. # #
  23. # Example: #
  24. # #
  25. # Line 1: _shopify #
  26. # Line 2: buy #
  27. # Line 3: 2 diamonds #
  28. # Line 4: 20.00 #
  29. # #
  30. # With sales it look's like this ^ #
  31. # #
  32. # #
  33. # Script has been created by: #
  34. # - krzysek #
  35. # #
  36. # ** Sorry for my english :C #
  37. # but I think you understand greater #
  38. # part of it. #
  39. # #
  40. #--------------////////////////-------------#
  41.  
  42.  
  43.  
  44. On sign change:
  45. if line 1 is "_shopify":
  46. if player has permission "shopify.create":
  47. if line 2 is "buy":
  48. set line 1 to "&4&l_&8Shopify"
  49. set line 2 to "&a&l--BUY--"
  50. set line 3 to "%coloured line 3%"
  51. message "&4&l_&8&lShopify &f> &aCreated shop ! (BUY)"
  52. if line 4 is empty:
  53. set line 4 to "&a&l-FOR FREE-"
  54. stop
  55. else:
  56. set line 4 to "%coloured line 4% $"
  57. stop
  58. else:
  59. if line 2 is "sell":
  60. set line 1 to "&4&l_&8Shopify"
  61. set line 2 to "&6&l--SELL--"
  62. if line 3 isn't empty:
  63. set line 3 to "%coloured line 3%"
  64. if line 4 isn't empty:
  65. set line 4 to "%coloured line 4% $"
  66. message "&4&l_&8&lShopify &f> &aCreated shop ! (SELL)"
  67. stop
  68. else:
  69. message "&4&l_&8&lShopify &f> &4&lERROR ! &c&lYou didn't speficy price ! (Line 4)"
  70. stop
  71. else:
  72. message "&4&l_&8&lShopify &f> &4&lERROR ! &c&lYou didn't speficy item ! (Line 3)"
  73. stop
  74. else:
  75. message "&4You don't have permissions to this."
  76. stop
  77.  
  78. On left click on sign:
  79. if line 1 of clicked block is "&4&l_&8Shopify":
  80. if line 2 of clicked block is "&a&l--BUY--":
  81. if player has permission "shopify.buy":
  82. cancel event
  83. if line 3 of clicked block is empty:
  84. message "&4&l_&8&lShopify &f> &4&lERROR ! &c&lLine 3 is empty !"
  85. stop
  86. else:
  87. if line 4 of clicked block is "&a&l-FOR FREE-":
  88. set {_buy} to "%uncoloured line 3 of clicked block%"
  89. set {_bu} to "%{_buy}%" parsed as items
  90. add {_bu} to player's inventory
  91. message "&4&l_&8&lShopify &f> &aYou bought: %coloured line 3 of clicked block% &afor free !"
  92. stop
  93. else:
  94. set {_price} to "%uncoloured line 4 of clicked block%"
  95. wait 1 tick
  96. set {_pric} to "%{_price}%" parsed as money
  97. set {_buy} to "%uncoloured line 3 of clicked block%"
  98. set {_bu} to "%{_buy}%" parsed as items
  99. if player's balance isn't greater than {_pric}:
  100. message "&4&l_&8&lShopify &f> &4You balance isn't greater than &3%{_price}% $"
  101. stop
  102. else:
  103. wait 1 tick
  104. replace all "$" with "" in {_price}
  105. wait 1 tick
  106. execute console command "money take %player% %{_price}%"
  107. add {_bu} to player's inventory
  108. message "&4&l_&8&lShopify &f> &aYou bought &3%{_bu}% &afor &3%{_price}% $"
  109. stop
  110. else:
  111. message "&4You don't have permissions to this."
  112. stop
  113. else:
  114. if line 2 of clicked block is "&6&l--SELL--":
  115. if player has permission "shopify.sell":
  116. cancel event
  117. if line 3 of clicked block is empty:
  118. message "&4&l_&8&lShopify &f> &4&lERROR ! &c&lLine 3 is empty !"
  119. stop
  120. else:
  121. if line 4 of clicked block is empty:
  122. message "&4&l_&8&lShopify &f> &4&lERROR ! &c&lLine 4 is empty !"
  123. stop
  124. else:
  125. set {_price} to "%uncoloured line 4 of clicked block%"
  126. wait 1 tick
  127. set {_pric} to "%{_price}%" parsed as money
  128. set {_sell} to "%uncoloured line 3 of clicked block%"
  129. set {_sel} to "%{_sell}%" parsed as items
  130. if player don't have {_sel}:
  131. message "&4&l_&8&lShopify &f> &4You can't sell this item beacouse you don't have it !"
  132. stop
  133. else:
  134. remove {_sel} from player's inventory
  135. wait 1 tick
  136. replace all "$" with "" in {_price}
  137. wait 1 tick
  138. execute console command "money give %player% %{_price}%"
  139. message "&4&l_&8&lShopify &f> &aYou sold &3%{_sel}% &afor &3%{_price}% $"
  140. stop
  141. else:
  142. message "&4You don't have permissions to this."
  143. stop
  144.  
  145. Command /shopify [<text>]:
  146. description: Shopify commands !
  147. aliases: _shop
  148. trigger:
  149. if arg 1 isn't set:
  150. message "--------------////////////////-------------"
  151. message "&3 --> &6/shopify remove &f:"
  152. message "&3 &f- &6Remove sign."
  153. message "--------------////////////////-------------"
  154. stop
  155. else:
  156. if arg 1 is "remove":
  157. if player has permission "shopify.remove":
  158. if target block is sign:
  159. if line 1 of target block is "&4&l_&8Shopify":
  160. set target block to air
  161. message "&4&l_&8&lShopify &f> &aSign has been removed."
  162. stop
  163. else:
  164. message "&4&l_&8&lShopify &f> &4This sign isn't to sell/buy."
  165. stop
  166. else:
  167. message "&4&l_&8&lShopify &f> &4Target block isn't a sign."
  168. stop
  169. else:
  170. message "&4You don't have permissions to this command."
  171. stop
Advertisement
Add Comment
Please, Sign In to add comment