Zeldaboy111

Skript #201 - tycoon

Jul 4th, 2019
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.36 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. 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. set {_world} to world of loop-player
  120. set {_x} to x-coordinate of targeted block of loop-player
  121. set {_y} to y-coordinate of targeted block of loop-player + 1
  122. set {_z} to z-coordinate of targeted block of loop-player
  123. set {_y2} to y-coordinate of targeted block of loop-player
  124. #set {tycoon::targetedBlock::%loop-player%} to location of targeted block of loop-player
  125.  
  126.  
  127. if {tycoon::targetedBlock::%loop-player%} is "%{_x}%, %{_y2}%, %{_z}%, %{_world}%":
  128. stop loop
  129.  
  130. if {tycoon::targetedBlock::%loop-player%} is "%{_x}%, %{_y}%, %{_z}%, %{_world}%":
  131. stop loop
  132.  
  133. set {tycoon::targetedBlock::%loop-player%} to "%{_x}%, %{_y}%, %{_z}%, %{_world}%"
  134. drawScematic(loop-player, "dirt_machine", "%{_x}%", "%{_y}%", "%{_z}%")
  135. #removeScematic(loop-player, "dirt_machine", "%{_x}%", "%{_y}%", "%{_z}%")
  136.  
  137.  
  138.  
  139.  
  140.  
  141. function drawScematic(p: Player, t: String, x: String, y: String, z: String):
  142. if {_t} is "dirt_machine":
  143. set {_world} to world of {_p}
  144. fill("%{_x} parsed as a number%", "%{_y} parsed as a number%", "%{_z} parsed as a number%", "%{_x} parsed as a number%", "%{_y} parsed as a number%", "%{_z} parsed as a number + 5%", "%{_world}%", "glass")
Add Comment
Please, Sign In to add comment