Zeldaboy111

Skript #213 - tycoon

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