Zeldaboy111

Bugfixing ]|[ Skript #433

Jul 12th, 2021
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.98 KB | None | 0 0
  1. options:
  2. prefix: &6Tycoon&8:&7
  3.  
  4. command /b:
  5. trigger:
  6. sendBalance()
  7.  
  8. function sendBalance():
  9. if {tc.loopingBalance} is true:
  10. stop
  11. set {tc.loopingBalance} to true
  12. while {tc.loopingBalance} is true:
  13. if {tc.stopped} is true:
  14. delete {tc.loopingBalance}
  15. if size of online players is 0:
  16. delete {tc.loopingBalance}
  17. else:
  18. loop all players:
  19. add {tc.%uuid of loop-player%.income} to {tc.%uuid of loop-player%.balance}
  20. send actionbar "&6Coins&8: &e%{tc.%uuid of loop-player%.balance}%" to loop-player
  21. wait 20 ticks
  22. on join:
  23. if {tc.%uuid of player%.balance} is not set:
  24. set {tc.%uuid of player%.balance} to 0
  25. sendBalance()
  26.  
  27. on enable:
  28. while {tc.loopingBalance} is true:
  29. wait 10 ticks
  30. if {tc.stopped}:
  31. delete {tc.stopped}
  32. sendBalance()
  33.  
  34. on disable:
  35. if {tc.loopingBalance} is true:
  36. set {tc.stopped} to true
  37. set {tc.loopingBalance} to false
  38.  
  39. function setLineData(sign: Location, line: String, firstType: String, secondType: String):
  40. set {_lines::*} to {_line} split at " "
  41. if size of {_lines::*} is not 2:
  42. stop
  43.  
  44. set {_firstValue} to {_lines::1} parsed as an integer
  45. set {_secondValue} to {_lines::2} parsed as an integer
  46. if {_firstValue} is set:
  47. if {_secondValue} is set:
  48. if {_firstValue} > 0:
  49. if {_secondValue} > 0:
  50. set {tc.signdata.%{_sign}%.%{_firstType}%} to {_firstValue}
  51. set {tc.signdata.%{_sign}%.%{_secondType}%} to {_secondValue}
  52.  
  53. function updateSignVariables(sign: Location):
  54. add 1 to {tc.signdata.%{_sign}%.level}
  55. add {tc.signdata.%{_sign}%.costIncrease} to {tc.signdata.%{_sign}%.cost}
  56. if {tc.signdata.%{_sign}%.level} >= {tc.signdata.%{_sign}%.maxLevel}:
  57. set {tc.signdata.%{_sign}%.cost} to -1
  58.  
  59. on sign change:
  60. if line 1 doesn't start with "[T] ":
  61. stop
  62. setLineData(location of event-block, line 4 of event-block, "level", "maxLevel")
  63. setLineData(location of event-block, line 3 of event-block, "cost", "costIncrease")
  64. if {tc.signdata.%location of event-block%.level} >= {tc.signdata.%location of event-block%.maxLevel}:
  65. set {tc.signdata.%location of event-block%.cost} to -1
  66. # check if level >=, set cost to -1
  67. if {tc.signdata.%location of event-block%.cost} is not set:
  68. stop
  69. set {_l1} to line 1
  70. replace "[T] " in {_l1} with ""
  71. set line 1 to "&6&l%{_l1}%"
  72. set line 2 to ""
  73. if {tc.signdata.%location of event-block%.cost} > -1:
  74. set line 3 to "&eCost&8: &7%{tc.signdata.%location of event-block%.cost}%"
  75. else:
  76. set line 3 to "&eCost&8: &7Max Level"
  77. set line 4 to "&bLevel&8: &7%{tc.signdata.%location of event-block%.level}%"
  78. add location of event-block to {tc.signList.%uuid of player%::*}
  79.  
  80. on right click on sign:
  81. if {tc.signdata.%location of event-block%.cost} is not set:
  82. stop
  83. else if {tc.signdata.%location of event-block%.level} >= {tc.signdata.%location of event-block%.maxLevel}:
  84. play sound "entity.item.break" to player
  85. else if {tc.%uuid of player%.balance} < {tc.signdata.%location of event-block%.cost}:
  86. play sound "entity.item.break" to player
  87. else:
  88. remove {tc.signdata.%location of event-block%.cost} from {tc.%uuid of player%.balance}
  89. updateSignVariables(location of event-block)
  90. play sound "entity.player.levelup" to player
  91. if {tc.signdata.%location of event-block%.cost} > -1:
  92. set line 3 to "&eCost&8: &7%{tc.signdata.%location of event-block%.cost}%"
  93. else:
  94. set line 3 to "&eCost&8: &7Max Level"
  95. set line 4 to "&bLevel&8: &7%{tc.signdata.%location of event-block%.level}%"
  96.  
  97. on break of sign:
  98. if {tc.signdata.%location of event-block%.cost} is set:
  99. delete {tc.signdata.%location of event-block%.cost}
  100. delete {tc.signdata.%location of event-block%.costIncrease}
  101. delete {tc.signdata.%location of event-block%.level}
  102. delete {tc.signdata.%location of event-block%.maxLevel}
  103. remove location of event-block from {tc.signList.%uuid of player%::*}
  104.  
  105. on join:
  106. set {tc.%uuid of player%.income} to 9
  107. loop {tc.signList.%uuid of player%::*}:
  108. # add to income
  109. # Set income variable to line 2 when creating a sign!!!!
  110.  
Advertisement
Add Comment
Please, Sign In to add comment