Oxalist

Untitled

Dec 31st, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.27 KB | None | 0 0
  1. function crate(p: player, t: string, n: string):
  2. loop {crate.%{_t}%::*}:
  3. add {crate.%{_t}%::%loop-index%} to {_roll::*}
  4. open chest with 3 rows named {_n} to {_p}
  5. wait a tick
  6. set {_speedFinal} to 1
  7. set {_Selector1} to 4
  8. set {_Selector2} to 22
  9. loop 9 times:
  10. set slot loop-number - 1 of {_p}'s current inventory to black stained glass pane named " "
  11. set slot loop-number + 17 of {_p}'s current inventory to black stained glass pane named " "
  12. set slot {_Selector1} of {_p}'s current inventory to shiny light green stained glass pane named " "
  13. set slot {_Selector2} of {_p}'s current inventory to shiny light green stained glass pane named " "
  14. loop random integer between 10 and 30 times:
  15. if inventory name of {_p}'s current inventory is {_n}:
  16. set {_run} to true
  17. else:
  18. set {_run} to false
  19. if {_run} is true:
  20. set {_sel} to 9
  21. loop 8 times:
  22. set {_sel2} to {_sel} - 1
  23. set {_item::%{_sel}%} to {_item::%{_sel2}%}
  24. subtract 1 from {_sel}
  25. set {_item::1} to a random element out of {_roll::*}
  26. loop 9 times:
  27. set slot 8 + loop-number-2 of {_p}'s current inventory to {_item::%loop-number-2%}
  28. play "BLOCK_NOTE_HAT" to {_p} at volume 1
  29. play "ENTITY_EXPERIENCE_ORB_PICKUP" to {_p} at volume 0.5
  30. add 1 to {_speed}
  31. if {_speed} is 5:
  32. set {_speed} to 0
  33. add 1 to {_speedFinal}
  34. loop {_speedFinal} times:
  35. wait a tick
  36. else:
  37. exit loop
  38. if {_run} is true:
  39. message "%{_n}% &a「%{_item::5}%&a」 &fGet!" to {_p}
  40. give {_p} slot 13 of {_p}'s current inventory
  41. remove 1 of {_p}'s tool from {_p}'s tool
  42.  
  43. function color(s: string) :: string:
  44. replace all "&" with "§" in {_s}
  45. return {_s}
  46.  
  47. command /crate [<string>] [<string>] [<string>]:
  48. permission: *
  49. trigger:
  50. if arg 1 isn't set:
  51. send "&6【Crate Data Manager】"
  52. send "&a/crate list &b- Show crate list."
  53. send "&a/crate item <name> &b- Show the item in the crate."
  54. send "&a/crate add <name> &b- Add item to crate."
  55. send "&a/crate remove <name> [<Item index>] &b- Remove item from the crate."
  56. send "&a/crate get <name> &b- Get the crate"
  57. send "&c※ Item index - &e/crate item <name> &cUse this command."
  58. if arg 1 is "list":
  59. send "&b【Crate List】"
  60. loop {crate.type::*}:
  61. send "&r%loop-index%"
  62. if arg 1 is "item":
  63. if arg 2 is set:
  64. send "&aItem of &r%arg 2%"
  65. loop {crate.%arg 2%::*}:
  66. send "[%loop-index%] %loop-value%"
  67. if arg 1 is "add":
  68. if arg 2 is set:
  69. add player's tool to {crate.%arg 2%::*}
  70. set {crate.type::%arg 2%} to true
  71. send "&aAdd &e%player's tool% &ato &r%arg 2%"
  72. if arg 1 is "remove":
  73. if arg 2 is set:
  74. if arg 3 is set:
  75. send "&cRemoved the item. &r%{crate.%arg 2%::%arg 3%}% &cin &r%arg 2%"
  76. delete {crate.%arg 2%::%arg 3%}
  77. delete {crate.type::%arg 2%}
  78. else:
  79. delete {crate.%arg 2%::*}
  80. delete {crate.type::%arg 2%}
  81. send "&cRemoved the crate. &r%arg 2%"
  82. if arg 1 is "get":
  83. if arg 2 is set:
  84. give 1 chest named "%arg 2%" to player
  85.  
  86. inventory click:
  87. loop {crate.type::*}:
  88. if inventory name of player's current inventory is color("%loop-index%"):
  89. cancel event
  90.  
  91. right click:
  92. loop {crate.type::*}:
  93. if color("%loop-index%") is name of player's tool:
  94. crate(player, "%loop-index%", color("%loop-index%"))
Advertisement
Add Comment
Please, Sign In to add comment