Zeldaboy111

Signs ]|[ Skript #432

Jul 11th, 2021
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.19 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. if size of online players is 0:
  12. delete {tc.loopingBalance}
  13. else:
  14. loop all players:
  15. send actionbar "&6Coins&8: &e%{tc.%uuid of loop-player%.balance}%" to loop-player
  16. wait 40 ticks
  17. on join:
  18. if {tc.%uuid of player%.balance} is not set:
  19. set {tc.%uuid of player%.balance} to 0
  20. sendBalance()
  21.  
  22. on enable:
  23. while {tc.loopingBalance} is true:
  24. wait 10 ticks
  25. if {tc.stopped}:
  26. sendBalance()
  27. delete {tc.stopped}
  28.  
  29. on disable:
  30. if {tc.loopingBalance} is true:
  31. set {tc.stopped} to true
  32.  
  33. function setLineData(sign: Location, line: String, firstType: String, secondType: String):
  34. set {_lines::*} to {_line} split at " "
  35. if size of {_lines::*} is not 2:
  36. stop
  37.  
  38. set {_firstValue} to {_lines::1} parsed as an integer
  39. set {_secondValue} to {_lines::2} parsed as an integer
  40. if {_firstValue} is set:
  41. if {_secondValue} is set:
  42. if {_firstValue} > 0:
  43. if {_secondValue} > 0:
  44. set {tc.signdata.%{_sign}%.%{_firstType}%} to {_firstValue}
  45. set {tc.signdata.%{_sign}%.%{_secondType}%} to {_secondValue}
  46.  
  47. function updateSignVariables(sign: Location):
  48. add 1 to {tc.signdata.%{_sign}%.level}
  49. add {tc.signdata.%{_sign}%.costIncrease} to {tc.signdata.%{_cost}%.cost}
  50. if {tc.signdata.%{_sign}%.level} >= {tc.signdata.%{_sign}%.maxLevel}:
  51. set {tc.signdata.%{_sign}%.cost} to -1
  52.  
  53. function updateSign(sign: Location, block: Block):
  54. # Update sign?
  55. if {tc.signdata.%{_sign}%.cost} < 0:
  56. set line 3 of {_block} to "&eCost&8: &7%{tc.signdata.%{_sign}%.cost}%"
  57. else:
  58. set line 3 of {_block} to "&eCost&8: &7Max Level"
  59. set line 4 of {_block} to "&bLevel&8: &7%{tc.signdata.%{_sign}%.level}%"
  60.  
  61. on sign change:
  62. if line 1 is not "Tycoon":
  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. # check if level >=, set cost to -1
  67. if {tc.signdata.%location of event-block%.cost} is not set:
  68. stop
  69. set line 1 to "&6&l%line 2%"
  70. set line 2 to ""
  71. updateSign(location of event-block, event-block)
  72.  
  73. on right click on sign:
  74. if {tc.signdata.%location of event-block%.cost} is not set:
  75. stop
  76. else if {tc.signdata.%location of event-block%.level} >= {tc.signdata.%location of event-block%.maxLevel}:
  77. play sound "entity.item.break" to player
  78. else if {tc.%uuid of player%.balance} < {tc.signdata.%location of event-block%.cost}:
  79. play sound "entity.item.break" to player
  80. else:
  81. remove {tc.signdata.%location of event-block%.cost} from {tc.%uuid of player%.balance}
  82. play sound "entity.player.levelup" to player
  83. updateSignVariables(location of event-block)
  84. updateSign(location of event-block, event-block)
  85.  
  86. on break of sign:
  87. if {tc.signdata.%location of event-block%.cost} is set:
  88. delete {tc.signdata.%location of event-block%.cost}
  89. delete {tc.signdata.%location of event-block%.costIncrease}
  90. delete {tc.signdata.%location of event-block%.level}
  91. delete {tc.signdata.%location of event-block%.maxLevel}
  92.  
Advertisement
Add Comment
Please, Sign In to add comment