Solar-Modz

gen skript

Nov 21st, 2022
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.41 KB | None | 0 0
  1. #skbee
  2. on load:
  3. set {gens::wheat} to hay block named "&e&lWheat Gen" with lore "&7-----&8-----" and "&7Produces wheat every 10 seconds" and "&7Upgrade cost: &e500⛃" and "&7-----&8-----"
  4. set {gens::coal} to coal block named "&8&lCoal Gen" with lore "&7-----&8-----" and "&7Produces coal every 10 seconds" and "&7Upgrade cost: &e1000⛃" and "&7-----&8-----"
  5. set {items::wheat} to wheat named "&eWheat" with lore "&7-----&8-----" and "&7Sell Price: &e10⛃" and "&7-----&8-----"
  6. set {items::coal} to coal named "&8Coal" with lore "&7-----&8-----" and "&7Sell Price: &e20⛃" and "&7-----&8-----"
  7.  
  8. command /givegen [<text>]:
  9. permission: op
  10. trigger:
  11. if arg-1 is set:
  12. give player {gens::%arg-1%}
  13. else:
  14. message "&cInvalid Arguments! Usage: /givegen <gen>"
  15.  
  16. on place:
  17. if player's tool is hay block:
  18. placeGen("Wheat", player, event-block's location)
  19. if player's tool is coal block:
  20. placeGen("Coal", player, event-block's location)
  21.  
  22.  
  23. on left click:
  24. if event-block is hay block:
  25. breakGen("Wheat", player, event-block's location)
  26. if event-block is coal block:
  27. breakGen("Coal", player, event-block's location)
  28.  
  29.  
  30.  
  31. function placeGen(n: text, p: player, l: location):
  32. if {usedslots::%{_p}'s uuid%} = {maxslots::%{_p}'s uuid%}:
  33. send action bar "&8* &cGen cap reached! &7(&e%{usedslots::%{_p}'s uuid%}%&7/&e%{maxslots::%{_p}'s uuid%}%&7)" to {_p}
  34. play sound "entity.villager.no" at volume 1 at pitch 1 to {_p}
  35. set block at {_l} to air
  36. give {_p} {gens::%{_n}%}
  37. else:
  38. add {_l}'s location to {gensplaced::%{_n}%::%{_p}'s uuid%::*}
  39. add 1 to {usedslots::%{_p}'s uuid%}
  40. send action bar "&8* &7Placed a &e%{_n}% Gen &7(&e%{usedslots::%{_p}'s uuid%}%&7/&e%{maxslots::%{_p}'s uuid%}%&7)" to {_p}
  41. play sound "block.note_block.pling" at volume 1 at pitch 2 to {_p}
  42. make 10 of poof at {_l}
  43.  
  44.  
  45. function breakGen(n: text, p: player, l: location):
  46. remove 1 from {usedslots::%{_p}'s uuid%}
  47. remove {_l}'s location from {gensplaced::%{_n}%::%{_p}'s uuid%::*}
  48. send action bar "&8* &7Picked up a &e%{_n}% Gen &7(&e%{usedslots::%{_p}'s uuid%}%&7/&e%{maxslots::%{_p}'s uuid%}%&7)" to {_p}
  49. play sound "block.note_block.pling" at volume 1 at pitch 1 to {_p}
  50. make 10 of poof at {_l}
  51. give {_p} {gens::%{_n}%}
  52. set block at {_l} to air
  53.  
  54. every 10 seconds:
  55. loop all players:
  56. loop all blocks in radius 30 around loop-player:
  57. if {gensplaced::Wheat::%loop-player's uuid%::*} contains loop-block's location:
  58. set {_loc} to block above loop-value-2
  59. drop 1 of {items::wheat} 1 meters above {_loc} without velocity
  60. if {gensplaced::Coal::%loop-player's uuid%::*} contains loop-block's location:
  61. set {_loc} to block above loop-value-2
  62. drop 1 of {items::coal} 1 meters above {_loc} without velocity
  63.  
  64.  
  65.  
  66.  
  67. command /sell:
  68. trigger:
  69. set {_total} to 0
  70. set {_wheatamt} to amount of wheat in player's inventory
  71. remove all wheat from player's inventory
  72. add {_wheatamt} * 10 to {_total}
  73. set {_coalamt} to amount of coal in player's inventory
  74. remove all coal from player's inventory
  75. add {_coalamt} * 20 to {_total}
  76. add {_total} to {coins::%player's uuid%}
  77. send title "&7Sale Summary:" with subtitle "&e+%{_total}%⛃" for 5 seconds
  78. play sound "entity.horse.armor" at volume 1 at pitch 1 to player
  79.  
  80. every 2 seconds:
  81. loop all players:
  82. send action bar "&e%{coins::%loop-player's uuid%}%⛃ &7Gen Slots: &e%{usedslots::%loop-player's uuid%}%&7/&e%{maxslots::%loop-player's uuid%}%" to loop-player
  83.  
  84. on right click:
  85. if clicked block is set:
  86. player is sneaking
  87. if clicked block is hay block:
  88. {upgradeclick::%player's uuid%} is false
  89. set {upgradeclick::%player's uuid%} to true
  90. wait 1 tick
  91. remove clicked block's location from {gensplaced::Wheat::%player's uuid%::*}
  92. add clicked block's location to {gensplaced::Coal::%player's uuid%::*}
  93. set clicked block to coal block
  94. send title "&e&lUpgraded" with subtitle "&7Wheat -> Coal" to player
  95. wait 0.5 seconds
  96. set {upgradeclick::%player's uuid%} to false
  97. stop
  98. if clicked block is coal block:
  99. {upgradeclick::%player's uuid%} is false
  100. set {upgradeclick::%player's uuid%} to true
  101. wait 1 tick
  102. send title "&c&lNot Coded Yet" with subtitle "&7Coal -> ?" to player
  103. wait 0.5 seconds
  104. set {upgradeclick::%player's uuid%} to false
  105. stop
  106.  
  107. command /start:
  108. trigger:
  109. if {start::%player's uuid%} is not true:
  110. set {start::%player's uuid%} to true
  111. execute player command "/p auto"
  112. give player {gens::Wheat}
  113. wait 1 second
  114. send title "&ePlace your gen to begin!" with subtitle " " to player for 3 seconds
  115.  
  116. on join:
  117. set {upgradeclick::%player's uuid%} to false
  118. if {coins::%player's uuid%} is not set:
  119. set {coins::%player's uuid%} to 0
  120. if {usedslots::%player's uuid%} is not set:
  121. set {usedslots::%player's uuid%} to 0
  122. if {maxslots::%player's uuid%} is not set:
  123. set {maxslots::%player's uuid%} to 10
Add Comment
Please, Sign In to add comment