Zeldaboy111

Skript #214 - tycoon

Jul 16th, 2019
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.43 KB | None | 0 0
  1.  
  2. options:
  3. prefix: &f[&2Tycoon&f] &8>>
  4. version: 1.0
  5.  
  6. command /tycoon [<text>] [<text>]:
  7. trigger:
  8. if player has permission "Tycoon.*":
  9. if arg 1 is "help":
  10. send "&f--------------[&2Tycoon&f]--------------"
  11. send "&a/Tycoon help &8>> &2Krijg de help pagina"
  12. send "&a/Tycoon shop create &8>> &2Maak een shop"
  13. send "&a/Tycoon shop &8>> &2Ga naar het shop gui"
  14. send "&a/Tycoon shop remove &8>> &2Verwijder de shop"
  15. send "&f--------------[&2Tycoon&f]--------------"
  16.  
  17. if arg 1 is "shop":
  18. if arg 2 is "create":
  19. send "{@prefix} &2Succesvol een shop item gegeven."
  20. give player a book named "&6Create Shop" with lore "&5Klik om een shop te maken - Tycoon"
  21. #send "{@prefix} &aSuccesvol de shop gemaakt!"
  22. #spawn Llama at player
  23. #set {_Llama} to last spawned Llama
  24. #set name of last spawned Llama to "&6Tycoon shop"
  25. #add "{Age:1,NoAI:1,Silent:1b,Invulnerable:1}" to nbt tag of {_Llama}
  26.  
  27.  
  28. else if arg 2 is set:
  29. send "{@prefix} &4Dit command is niet goed uitgevoerd, doe &c/tycoon stop create&4."
  30.  
  31.  
  32. else:
  33. send "{@prefix} &4Doe &c/tycoon help &4voor meer info."
  34.  
  35. else if arg 1 is "help":
  36. send "&f--------------[&2Tycoon&f]--------------"
  37. send "&a/Tycoon help &8>> &2Krijg de help pagina"
  38. send "&a/Tycoon shop &8>> &2Ga naar het shop gui"
  39. send "&f--------------[&2Tycoon&f]--------------"
  40.  
  41. else if arg 1 is "shop":
  42. send "{@prefix} &2Shop geoopent."
  43.  
  44. on rightclick on a villager:
  45. wait 1 tick
  46. set {_world} to world of clicked entity
  47. set {_locX} to x-coordinate of clicked entity
  48. set {_locY} to y-coordinate of clicked entity
  49. set {_locZ} to z-coordinate of clicked entity
  50.  
  51. open chest with 1 rows named "&6Tycoon Shop" to player
  52. make gui slot 0 of player with redstone dust named "&6Machine Shop" to close then run function openShop(player, "machines")
  53. make gui slot 8 of player with barrier named "&4Delete Shop" to run function removeShop(player, clicked entity, "%{_locX}%", "%{_locY}%", "%{_locZ}%", "%{_world}%")
  54.  
  55.  
  56.  
  57. on rightclick:
  58. if player is holding a book named "&6Create Shop" with lore "&5Klik om een shop te maken - Tycoon":
  59.  
  60. set {_locX} to x-coordinate of targeted block
  61. set {_locY} to y-coordinate of targeted block+0.5
  62. set {_locZ} to z-coordinate of targeted block
  63.  
  64. set {_block} to location of targeted block
  65.  
  66. loop blocks in radius 5 around player:
  67. if location of loop-block is {_block}:
  68.  
  69. send "{@prefix} &2Succesvol de shop gemaakt!"
  70. set {_gm} to gamemode of player
  71.  
  72. if gamemode of player is not creative:
  73. remove 1 of tool from tool
  74.  
  75. spawn villager at location {_locX}, {_locY}, {_locZ}
  76. set {_villager} to last spawned villager
  77. set name of last spawned villager to "&6Tycoon shop"
  78. add "{Profession:5,Age:1,NoAI:1,Silent:1b,Invulnerable:1}" to nbt tag of {_villager}
  79. add "%world of player% - %{_locX}%, %{_locY}%, %{_locZ}%" to {Tycoon::shopLocations::*}
  80.  
  81.  
  82. on death of villager:
  83. if attacker is a player:
  84. if name of villager is "&6Tycoon shop":
  85.  
  86. set {_locX} to x-coordinate of victim
  87. set {_locY} to y-coordinate of victim
  88. set {_locZ} to z-coordinate of victim
  89.  
  90. if {Tycoon::shopLocations::*} doesn't contain "%world of victim% - %{_locX}%, %{_locY}%, %{_locZ}%":
  91. stop
  92. else:
  93. remove "%world of victim% - %{_locX}%, %{_locY}%, %{_locZ}%" from {Tycoon::shopLocations::*}
  94. send "{@prefix} &2Succesvol de shop verwijderd!" to attacker
  95.  
  96. play "block_wood_hit" to attacker at volume 10
  97.  
  98. set {_item} to false
  99.  
  100. loop items in attacker's inventory:
  101. if loop-item is a book named "&6Create Shop" with lore "&5Klik om een shop te maken - Tycoon":
  102. set {_item} to true
  103. stop loop
  104.  
  105. else:
  106. set {_item} to false
  107.  
  108. if {_item} is false:
  109. give attacker a book named "&6Create Shop" with lore "&5Klik om een shop te maken - Tycoon"
  110.  
  111.  
  112. every 1 tick:
  113. loop all players:
  114.  
  115. if loop-player is holding a paper named "&6Dirt machine" with lore "&5Tycoon Machine":
  116. set {_block} to location of targeted block of loop-player
  117. loop blocks in radius 5 around loop-player:
  118. if location of loop-block is {_block}:
  119.  
  120.  
  121. set {_dir} to the facing of loop-player
  122. set {_world} to world of loop-player
  123. set {_x} to x-coordinate of targeted block of loop-player
  124. set {_y} to y-coordinate of targeted block of loop-player + 1
  125. set {_z} to z-coordinate of targeted block of loop-player
  126. set {_y2} to y-coordinate of targeted block of loop-player
  127.  
  128. set {tycoon::scematicDrawn::%loop-player%} to true
  129. if {tycoon::targetedBlock::%loop-player%} is "%{_x}%, %{_y2}%, %{_z}%, %{_world}%":
  130. stop loop
  131.  
  132. if {tycoon::targetedBlock::%loop-player%} is "%{_x}%, %{_y}%, %{_z}%, %{_world}%":
  133. stop loop
  134.  
  135. if {tycoon::scematic::%loop-player%} is "dirt_machine":
  136. removeScematic(loop-player, "dirt_machine", "%{tycoon::scematic::%loop-player%::x}%", "%{tycoon::scematic::%loop-player%::y}%", "%{tycoon::scematic::%loop-player%::z}%", {tycoon::scematic::%loop-player%::dir})
  137.  
  138. set {tycoon::targetedBlock::%loop-player%} to "%{_x}%, %{_y}%, %{_z}%, %{_world}%"
  139. set {tycoon::scematic::%loop-player%::x} to "%{_x}%"
  140. set {tycoon::scematic::%loop-player%::y} to "%{_y}%"
  141. set {tycoon::scematic::%loop-player%::z} to "%{_z}%"
  142. set {tycoon::scematic::%loop-player%::dir} to {_dir}
  143. set {tycoon::scematic::%loop-player%} to "dirt_machine"
  144.  
  145. drawScematic(loop-player, "dirt_machine", "%{_x}%", "%{_y}%", "%{_z}%", {_dir})
  146.  
  147. else:
  148. if {tycoon::targetedBlock::%loop-player%} is set:
  149. if {tycoon::scematic::%loop-player%} is "dirt_machine":
  150. removeScematic(loop-player, "dirt_machine", "%{tycoon::scematic::%loop-player%::x}%", "%{tycoon::scematic::%loop-player%::y}%", "%{tycoon::scematic::%loop-player%::z}%", {tycoon::scematic::%loop-player%::dir})
  151. delete {tycoon::scematic::%loop-player%}
  152. delete {tycoon::targetedBlock::%loop-player%}
  153.  
  154. function drawScematic(p: Player, t: String, x: String, y: String, z: String, direction: Direction):
  155. if {_t} is "dirt_machine":
  156. set {_world} to world of {_p}
  157. set {_opposite} to getOppositeDirection({_direction})
  158. fill("%{_x} parsed as a number%", "%{_y} parsed as a number%", "%{_z} parsed as a number%", addNumber({_x} parsed as a number, {_y} parsed as a number, {_z} parsed as a number, {_world}, {_opposite}, 6.0), "%{_world}%", "scematic_dirt_machine", {_p})
  159. fill("%{_x} parsed as a number%", "%{_y} parsed as a number%", "%{_z} parsed as a number%", addNumber({_x} parsed as a number, {_y} parsed as a number, {_z} parsed as a number, {_world}, {_opposite}, 6.0), "%{_world}%", "scematic_dirt_machine", {_p})
  160.  
  161.  
  162. function removeScematic(p: player, t: String, x: String, y: String, z: String, direction: Direction):
  163. if {_t} is "dirt_machine":
  164. set {_world} to world of {_p}
  165. set {_opposite} to getOppositeDirection({_direction})
  166. remove("%{_x} parsed as a number%", "%{_y} parsed as a number%", "%{_z} parsed as a number%", addNumber({_x} parsed as a number, {_y} parsed as a number, {_z} parsed as a number, {_world}, {_opposite}, 6.0), "%{_world}%", "scematic_dirt_machine", {_p})
  167.  
  168.  
  169.  
  170. command /data:
  171. trigger:
  172.  
  173. set {_world} to world of player
  174. set {_dir} to facing of player
  175. set {_opposite} to getOppositeDirection({_dir})
  176. set {_block} to getUpStairDirection(wooden_stairs, {_dir}, 0)
  177. #set {_block} to getDirectionalBlock(dirt, {_opposite})
  178. #set {_block} to "wooden_stairs:1"
  179. #send "%{_block}%"
  180. set targeted block to {_block}
  181. #send "%data of targeted block of player%"
  182. #set block at location of targeted block to stairs:1
  183. #add "{Facing:2}" to nbt tag of block at location of targeted block
  184.  
  185. command /downdata:
  186. trigger:
  187. set {_world} to world of player
  188. set {_dir} to facing of player
  189. set {_opposite} to getOppositeDirection({_dir})
  190. set {_loc} to location of targeted block of player
  191. #fillDir(player, "scematic_dirt_machine", "%world of player%", {_opposite}, "%x-coordinate of player%", "%y-coordinate of player%", "%z-coordinate of player%", {_loc}, 0, 0, 0)
  192. fillDir(player, "scematic_dirt_machine" , "%world of player%", {_opposite}, "%x-coordinate of targeted block%", "%y-coordinate of targeted block%", "%z-coordinate of targeted block%", {_loc}, 3, 3, 3)
  193. #set {_opposite} to getOppositeDirection({_dir})
  194. #set {_block} to getDownStairDirection(wooden_stairs, {_dir}, 0)
  195.  
  196. #send "%{_block}%"
  197. #set targeted block to {_block}
Add Comment
Please, Sign In to add comment