Zeldaboy111

Income ]|[ Skript #434

Jul 18th, 2021
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.30 KB | None | 0 0
  1. options:
  2. prefix: &6Tycoon&8:&7
  3.  
  4. function sendBalance():
  5. if {tc.loopingBalance} is true:
  6. stop
  7. set {tc.loopingBalance} to true
  8. while {tc.loopingBalance} is true:
  9. if {tc.stopped} is true:
  10. delete {tc.loopingBalance}
  11. else if size of online players is 0:
  12. delete {tc.loopingBalance}
  13. else:
  14. loop all players:
  15. add {tc.%uuid of loop-player%.income} to {tc.%uuid of loop-player%.balance}
  16. send actionbar "&6Coins&8: &e%{tc.%uuid of loop-player%.balance}%" to loop-player
  17. wait 20 ticks
  18. on join:
  19. if {tc.%uuid of player%.balance} is not set:
  20. set {tc.%uuid of player%.balance} to 0
  21.  
  22. set {tc.%uuid of player%.income} to 1
  23. loop {tc.signList.%uuid of player%::*}:
  24. add {tc.signdata.%loop-value%.income} to {tc.%uuid of player%.income}
  25. sendBalance()
  26.  
  27. on enable:
  28. while {tc.loopingBalance} is true:
  29. wait 20 ticks
  30. if {tc.stopped}:
  31. wait 1 tick
  32. delete {tc.stopped}
  33. sendBalance()
  34.  
  35. on disable:
  36. if {tc.loopingBalance} is true:
  37. set {tc.stopped} to true
  38. set {tc.loopingBalance} to false
  39.  
  40. function setLineData(sign: Location, line: String, firstType: String, secondType: String):
  41. set {_lines::*} to {_line} split at " "
  42. if size of {_lines::*} is not 2:
  43. stop
  44.  
  45. set {_firstValue} to {_lines::1} parsed as an integer
  46. set {_secondValue} to {_lines::2} parsed as an integer
  47. if {_firstValue} is set:
  48. if {_secondValue} is set:
  49. if {_firstValue} > 0:
  50. if {_secondValue} > 0:
  51. set {tc.signdata.%{_sign}%.%{_firstType}%} to {_firstValue}
  52. set {tc.signdata.%{_sign}%.%{_secondType}%} to {_secondValue}
  53.  
  54. function updateSignVariables(sign: Location):
  55. add 1 to {tc.signdata.%{_sign}%.level}
  56. add {tc.signdata.%{_sign}%.costIncrease} to {tc.signdata.%{_sign}%.cost}
  57. add {tc.signdata.%{_sign}%.income} to {tc.signdata.%{_sign}%.income}
  58. if {tc.signdata.%{_sign}%.level} >= {tc.signdata.%{_sign}%.maxLevel}:
  59. set {tc.signdata.%{_sign}%.cost} to -1
  60.  
  61. on sign change:
  62. if line 1 doesn't start with "[T] ":
  63. stop
  64. setLineData(location of event-block, line 4 of event-block, "level", "maxLevel")
  65. setLineData(location of event-block, line 3 of event-block, "cost", "costIncrease")
  66. setLineData(location of event-block, line 2 of event-block, "income", "incomeIncrease")
  67. if {tc.signdata.%location of event-block%.level} >= {tc.signdata.%location of event-block%.maxLevel}:
  68. set {tc.signdata.%location of event-block%.cost} to -1
  69. if {tc.signdata.%location of event-block%.cost} is not set:
  70. stop
  71. set {_l1} to line 1
  72. replace "[T] " in {_l1} with ""
  73. set line 1 to "&6&l%{_l1}%"
  74. set line 2 to ""
  75. if {tc.signdata.%location of event-block%.cost} > -1:
  76. set line 3 to "&eCost&8: &7%{tc.signdata.%location of event-block%.cost}%"
  77. else:
  78. set line 3 to "&eCost&8: &7Max Level"
  79. set line 4 to "&bLevel&8: &7%{tc.signdata.%location of event-block%.level}%"
  80. add location of event-block to {tc.signList.%uuid of player%::*}
  81.  
  82. on right click on sign:
  83. if {tc.signdata.%location of event-block%.cost} is not set:
  84. stop
  85. else if {tc.signdata.%location of event-block%.level} >= {tc.signdata.%location of event-block%.maxLevel}:
  86. play sound "entity.item.break" to player
  87. else if {tc.%uuid of player%.balance} < {tc.signdata.%location of event-block%.cost}:
  88. play sound "entity.item.break" to player
  89. else:
  90. remove {tc.signdata.%location of event-block%.cost} from {tc.%uuid of player%.balance}
  91. updateSignVariables(location of event-block)
  92. add {tc.signdata.%location of event-block%.incomeIncrease} to {tc.%uuid of player%.income}
  93. play sound "entity.player.levelup" to player
  94. if {tc.signdata.%location of event-block%.cost} > -1:
  95. set line 3 to "&eCost&8: &7%{tc.signdata.%location of event-block%.cost}%"
  96. else:
  97. set line 3 to "&eCost&8: &7Max Level"
  98. set line 4 to "&bLevel&8: &7%{tc.signdata.%location of event-block%.level}%"
  99.  
  100. on break of sign:
  101. if {tc.signdata.%location of event-block%.cost} is set:
  102. delete {tc.signdata.%location of event-block%.cost}
  103. delete {tc.signdata.%location of event-block%.costIncrease}
  104. delete {tc.signdata.%location of event-block%.level}
  105. delete {tc.signdata.%location of event-block%.maxLevel}
  106. remove location of event-block from {tc.signList.%uuid of player%::*}
  107. options:
  108. prefix: &6Tycoon&8:&7
  109.  
  110. function sendBalance():
  111. if {tc.loopingBalance} is true:
  112. stop
  113. set {tc.loopingBalance} to true
  114. while {tc.loopingBalance} is true:
  115. if {tc.stopped} is true:
  116. delete {tc.loopingBalance}
  117. else if size of online players is 0:
  118. delete {tc.loopingBalance}
  119. else:
  120. loop all players:
  121. add {tc.%uuid of loop-player%.income} to {tc.%uuid of loop-player%.balance}
  122. send actionbar "&6Coins&8: &e%{tc.%uuid of loop-player%.balance}%" to loop-player
  123. wait 20 ticks
  124. on join:
  125. if {tc.%uuid of player%.balance} is not set:
  126. set {tc.%uuid of player%.balance} to 0
  127.  
  128. set {tc.%uuid of player%.income} to 1
  129. loop {tc.signList.%uuid of player%::*}:
  130. add {tc.signdata.%loop-value%.income} to {tc.%uuid of player%.income}
  131. sendBalance()
  132.  
  133. on enable:
  134. while {tc.loopingBalance} is true:
  135. wait 20 ticks
  136. if {tc.stopped}:
  137. wait 1 tick
  138. delete {tc.stopped}
  139. sendBalance()
  140.  
  141. on disable:
  142. if {tc.loopingBalance} is true:
  143. set {tc.stopped} to true
  144. set {tc.loopingBalance} to false
  145.  
  146. function setLineData(sign: Location, line: String, firstType: String, secondType: String):
  147. set {_lines::*} to {_line} split at " "
  148. if size of {_lines::*} is not 2:
  149. stop
  150.  
  151. set {_firstValue} to {_lines::1} parsed as an integer
  152. set {_secondValue} to {_lines::2} parsed as an integer
  153. if {_firstValue} is set:
  154. if {_secondValue} is set:
  155. if {_firstValue} > 0:
  156. if {_secondValue} > 0:
  157. set {tc.signdata.%{_sign}%.%{_firstType}%} to {_firstValue}
  158. set {tc.signdata.%{_sign}%.%{_secondType}%} to {_secondValue}
  159.  
  160. function updateSignVariables(sign: Location):
  161. add 1 to {tc.signdata.%{_sign}%.level}
  162. add {tc.signdata.%{_sign}%.costIncrease} to {tc.signdata.%{_sign}%.cost}
  163. add {tc.signdata.%{_sign}%.income} to {tc.signdata.%{_sign}%.income}
  164. if {tc.signdata.%{_sign}%.level} >= {tc.signdata.%{_sign}%.maxLevel}:
  165. set {tc.signdata.%{_sign}%.cost} to -1
  166.  
  167. on sign change:
  168. if line 1 doesn't start with "[T] ":
  169. stop
  170. setLineData(location of event-block, line 4 of event-block, "level", "maxLevel")
  171. setLineData(location of event-block, line 3 of event-block, "cost", "costIncrease")
  172. setLineData(location of event-block, line 2 of event-block, "income", "incomeIncrease")
  173. if {tc.signdata.%location of event-block%.level} >= {tc.signdata.%location of event-block%.maxLevel}:
  174. set {tc.signdata.%location of event-block%.cost} to -1
  175. if {tc.signdata.%location of event-block%.cost} is not set:
  176. stop
  177. set {_l1} to line 1
  178. replace "[T] " in {_l1} with ""
  179. set line 1 to "&6&l%{_l1}%"
  180. set line 2 to ""
  181. if {tc.signdata.%location of event-block%.cost} > -1:
  182. set line 3 to "&eCost&8: &7%{tc.signdata.%location of event-block%.cost}%"
  183. else:
  184. set line 3 to "&eCost&8: &7Max Level"
  185. set line 4 to "&bLevel&8: &7%{tc.signdata.%location of event-block%.level}%"
  186. add location of event-block to {tc.signList.%uuid of player%::*}
  187.  
  188. on right click on sign:
  189. if {tc.signdata.%location of event-block%.cost} is not set:
  190. stop
  191. else if {tc.signdata.%location of event-block%.level} >= {tc.signdata.%location of event-block%.maxLevel}:
  192. play sound "entity.item.break" to player
  193. else if {tc.%uuid of player%.balance} < {tc.signdata.%location of event-block%.cost}:
  194. play sound "entity.item.break" to player
  195. else:
  196. remove {tc.signdata.%location of event-block%.cost} from {tc.%uuid of player%.balance}
  197. updateSignVariables(location of event-block)
  198. add {tc.signdata.%location of event-block%.incomeIncrease} to {tc.%uuid of player%.income}
  199. play sound "entity.player.levelup" to player
  200. if {tc.signdata.%location of event-block%.cost} > -1:
  201. set line 3 to "&eCost&8: &7%{tc.signdata.%location of event-block%.cost}%"
  202. else:
  203. set line 3 to "&eCost&8: &7Max Level"
  204. set line 4 to "&bLevel&8: &7%{tc.signdata.%location of event-block%.level}%"
  205.  
  206. on break of sign:
  207. if {tc.signdata.%location of event-block%.cost} is set:
  208. delete {tc.signdata.%location of event-block%.cost}
  209. delete {tc.signdata.%location of event-block%.costIncrease}
  210. delete {tc.signdata.%location of event-block%.level}
  211. delete {tc.signdata.%location of event-block%.maxLevel}
  212. remove location of event-block from {tc.signList.%uuid of player%::*}
  213.  
Advertisement
Add Comment
Please, Sign In to add comment