henry900326

Untitled

Jan 28th, 2018
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.04 KB | None | 0 0
  1.  
  2.  
  3. function RollLottery(P:player):
  4. set {_RollItem} to slot 40 of {_P}'s current inventory
  5. set slot 40 of {_P}'s current inventory to slot 41 of {_P}'s current inventory
  6. set slot 41 of {_P}'s current inventory to slot 42 of {_P}'s current inventory
  7. set slot 42 of {_P}'s current inventory to slot 43 of {_P}'s current inventory
  8.  
  9. set slot 43 of {_P}'s current inventory to slot 34 of {_P}'s current inventory
  10. set slot 34 of {_P}'s current inventory to slot 25 of {_P}'s current inventory
  11. set slot 25 of {_P}'s current inventory to slot 16 of {_P}'s current inventory
  12.  
  13. set slot 16 of {_P}'s current inventory to slot 15 of {_P}'s current inventory
  14. set slot 15 of {_P}'s current inventory to slot 14 of {_P}'s current inventory
  15. set slot 14 of {_P}'s current inventory to slot 13 of {_P}'s current inventory
  16. set slot 13 of {_P}'s current inventory to slot 12 of {_P}'s current inventory
  17. set slot 12 of {_P}'s current inventory to slot 11 of {_P}'s current inventory
  18. set slot 11 of {_P}'s current inventory to slot 10 of {_P}'s current inventory
  19.  
  20. set slot 10 of {_P}'s current inventory to slot 19 of {_P}'s current inventory
  21. set slot 19 of {_P}'s current inventory to slot 28 of {_P}'s current inventory
  22. set slot 28 of {_P}'s current inventory to slot 37 of {_P}'s current inventory
  23.  
  24. set slot 37 of {_P}'s current inventory to slot 38 of {_P}'s current inventory
  25. set slot 38 of {_P}'s current inventory to slot 39 of {_P}'s current inventory
  26. set slot 39 of {_P}'s current inventory to {_RollItem}
  27.  
  28. #==================================================================#
  29.  
  30. function SetLotteryGui(P:player):
  31. set {_count} to 0
  32. loop 54 times:
  33. set slot {_count} of {_P}'s current inventory to black stained Glass Pane named "&0"
  34. add 1 to {_count}
  35. set slot 49 of {_P}'s current inventory to hopper named "&6抽獎"
  36. #==================================================================#
  37. set slot 10 of {_P}'s current inventory to air
  38. set slot 11 of {_P}'s current inventory to air
  39. set slot 12 of {_P}'s current inventory to air
  40. set slot 13 of {_P}'s current inventory to air
  41. set slot 14 of {_P}'s current inventory to air
  42. set slot 15 of {_P}'s current inventory to air
  43. set slot 16 of {_P}'s current inventory to air
  44. #==================================================================#
  45. set slot 19 of {_P}'s current inventory to air
  46. set slot 28 of {_P}'s current inventory to air
  47. #==================================================================#
  48. set slot 25 of {_P}'s current inventory to air
  49. set slot 34 of {_P}'s current inventory to air
  50. #==================================================================#
  51. set slot 37 of {_P}'s current inventory to air
  52. set slot 38 of {_P}'s current inventory to air
  53. set slot 39 of {_P}'s current inventory to air
  54. set slot 40 of {_P}'s current inventory to air
  55. set slot 41 of {_P}'s current inventory to air
  56. set slot 42 of {_P}'s current inventory to air
  57. set slot 43 of {_P}'s current inventory to air
  58. #==================================================================#
  59.  
  60. on block break:
  61. if {%location of target block%.is.set} is true:
  62. delete {%location of target block%.is.set}
  63. set {_Save} to "%location of target block%" parsed as text
  64. set {_count} to 0
  65. loop 54 times:
  66. delete {%{_Save}%.獎品儲存.%{_count}%}
  67. add 1 to {_count}
  68. command /lottery [<text>] [<text>]:
  69. trigger:
  70. if arg-1 is "set":
  71. if target block is a chest:
  72. loop blocks in radius 4:
  73. loop-block is target block
  74. if {%location of target block%.is.set} is true:
  75. send "isset"
  76. else:
  77. send "set"
  78. set {%location of target block%.is.set} to true
  79. add location of target block to {Lottery_Box::*}
  80. else:
  81. send "noblock"
  82.  
  83. if arg-1 is "clear":
  84. send "%{Lottery_Box::*}%"
  85. delete {Lottery_Box::*}
  86. send "%{Lottery_Box::*}%"
  87. if arg-1 is "edit":
  88. if target block is a chest:
  89. loop blocks in radius 4:
  90. loop-block is target block
  91. if {%location of target block%.is.set} is true:
  92. open chest with 6 rows named "&0設定獎品 %location of target block%" to player
  93. SetLotteryGui(player)
  94. set {_Save} to name of player's current inventory
  95. replace "&0設定獎品 " with "" in {_Save}
  96. set {_count} to 0
  97. loop 54 times:
  98. set slot {_count} of player's current inventory to {%{_Save}%.獎品儲存.%{_count}%}
  99. add 1 to {_count}
  100.  
  101.  
  102.  
  103. on inventory click:
  104. name of player's current inventory contains "&0設定獎品":
  105. name of item is "&0" or "&6抽獎":
  106. cancel event
  107. on inventory close:
  108. name of player's current inventory contains "&0設定獎品":
  109. set {_Save} to name of player's current inventory
  110. replace "&0設定獎品 " with "" in {_Save}
  111. set {_count} to 0
  112. loop 54 times:
  113. set {%{_Save}%.獎品儲存.%{_count}%} to slot {_count} of player's current inventory
  114. add 1 to {_count}
  115.  
  116.  
  117. on right click on chest:
  118. if {%location of target block%.is.set} is true:
  119. cancel event
  120. open chest with 6 rows named "&0抽獎" to player
  121. SetLotteryGui(player)
  122. set {_Save} to "%location of target block%" parsed as text
  123. set {_count} to 0
  124. loop 54 times:
  125. set slot {_count} of player's current inventory to {%{_Save}%.獎品儲存.%{_count}%}
  126. add 1 to {_count}
  127.  
  128.  
  129.  
  130.  
  131. on inventory click:
  132. name of player's current inventory is "&0抽獎":
  133. cancel event
  134. if name of item contains "&6抽獎":
  135. set name of item to "&7抽獎機運作中..."
  136. set {抽獎中.%player%} to true
  137. loop 60 times:
  138. {抽獎中.%player%} is true
  139. RollLottery(player)
  140. wait 1 tick
  141. loop 30 times:
  142. {抽獎中.%player%} is true
  143. RollLottery(player)
  144. wait 2 tick
  145. loop 20 times:
  146. {抽獎中.%player%} is true
  147. RollLottery(player)
  148. wait 3 tick
  149. set {_Roll} to a random integer between 10 and 20
  150. loop {_Roll} times:
  151. {抽獎中.%player%} is true
  152. RollLottery(player)
  153. wait 5 tick
  154. set {_Roll} to a random integer between 5 and 10
  155. loop {_Roll} times:
  156. {抽獎中.%player%} is true
  157. RollLottery(player)
  158. wait 6 tick
  159. set {_Roll} to a random integer between 1 and 5
  160. loop {_Roll} times:
  161. {抽獎中.%player%} is true
  162. RollLottery(player)
  163. wait 8 tick
  164. loop 5 times:
  165. {抽獎中.%player%} is true
  166. RollLottery(player)
  167. wait 10 tick
  168. {抽獎中.%player%} is true
  169. wait 12 tick
  170. RollLottery(player)
  171. set name of item to "&6抽獎"
  172. set {抽獎中.%player%} to false
  173. give slot 40 of player's current inventory to player
  174.  
  175. on inventory close:
  176. name of player's current inventory is "&0抽獎":
  177. {抽獎中.%player%} is true
  178. set {抽獎中.%player%} to false
  179. set {_Lottery} to a random integer between 1 and 18
  180. {_Lottery} is 1:
  181. give slot 10 of player's current inventory to player
  182. {_Lottery} is 2:
  183. give slot 11 of player's current inventory to player
  184. {_Lottery} is 3:
  185. give slot 12 of player's current inventory to player
  186. {_Lottery} is 4:
  187. give slot 13 of player's current inventory to player
  188. {_Lottery} is 5:
  189. give slot 14 of player's current inventory to player
  190. {_Lottery} is 6:
  191. give slot 15 of player's current inventory to player
  192. {_Lottery} is 7:
  193. give slot 16 of player's current inventory to player
  194. {_Lottery} is 8:
  195. give slot 19 of player's current inventory to player
  196. {_Lottery} is 9:
  197. give slot 28 of player's current inventory to player
  198. {_Lottery} is 10:
  199. give slot 25 of player's current inventory to player
  200. {_Lottery} is 11:
  201. give slot 34 of player's current inventory to player
  202. {_Lottery} is 12:
  203. give slot 37 of player's current inventory to player
  204. {_Lottery} is 13:
  205. give slot 38 of player's current inventory to player
  206. {_Lottery} is 14:
  207. give slot 39 of player's current inventory to player
  208. {_Lottery} is 15:
  209. give slot 40 of player's current inventory to player
  210. {_Lottery} is 16:
  211. give slot 41 of player's current inventory to player
  212. {_Lottery} is 17:
  213. give slot 42 of player's current inventory to player
  214. {_Lottery} is 18:
  215. give slot 43 of player's current inventory to player
Advertisement
Add Comment
Please, Sign In to add comment