fleft17

Untitled

Oct 26th, 2014
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.77 KB | None | 0 0
  1. # Scatter Skript by Fleft. This is an advanced Skript. Use at your own risk. I am not responsible for any damage caused to servers because of this Skript.
  2.  
  3. # To disable/enable and of these features below, change them to simply "true" or "false".
  4.  
  5. # This was meant to be used in UHC games on www.reddit.com/r/ultrahardcore.
  6.  
  7. # Version: v1.3
  8.  
  9.  
  10. options:
  11.  
  12.  
  13. #--------------------------------------------------
  14. # Options
  15. #--------------------------------------------------
  16.  
  17. P: §f[§7Scatter]
  18. # Prefix for scatter messages
  19.  
  20. H: §9
  21. # Chat color when there's **x** seconds, **player**, misc
  22.  
  23. C: §f
  24. # Main chat color
  25.  
  26. Tries: 1001
  27. # Limit to how many times the Skript will attempt to load a given location
  28.  
  29. #--------------------------------------------------
  30. # Command
  31. #--------------------------------------------------
  32.  
  33. command /scatterall [<world>] [<integer>]:
  34. permission: skript.fleftscatter
  35. trigger:
  36. if arg-1 is not set:
  37. message "{@P}{@C} /scatterall <world> <radius>"
  38. else if arg-2 is not set:
  39. message "{@P}{@C} /scatterall <world> <radius>"
  40. else:
  41. command "/aps mob.enderdragon.growl"
  42. wait 25 ticks
  43. set {_ListOfAllPlayers::*} to all players
  44. set {_AmountOfPlayers} to (size of {_ListOfAllPlayers::*})
  45. loop {_ListOfAllPlayers::*}:
  46. add 1 to {_count}
  47. set {_ListOfAllPlayers::%{_count}%} to loop-value
  48. set {Scatter.DisableChunkUnload} to true
  49. set {_world} to arg-1
  50. set {_radius} to arg-2
  51. set {_mindist} to (({_radius}/{_AmountOfPlayers})*3)
  52. broadcast "{@P}{@C} Attempting to scatter {@H}%{_AmountOfPlayers}%{@C} players."
  53. loop {_AmountOfPlayers} times:
  54. loop {@Tries} times:
  55. if loop-number-2 is equal to {@Tries}:
  56. broadcast "{@P}{@C} Could not scatter {@H}%loop-number-1%/%{_AmountOfPlayers}%."
  57. broadcast "{@P}{@C} Some players may have been scattered!"
  58. command "/aps random.break"
  59. delete {Scatter.DisableChunkLoading}
  60. stop trigger
  61. else:
  62. set {_GoodLocation} to true
  63. set {_SkyLocation} to (the location at ((random integer between (0-{_radius}) and ({_radius}-1))+0.5), 255, ((random integer between (0-{_radius}) and ({_radius}-1))+0.5) of the world {_world})
  64. loop ((loop-number-1)-1) times:
  65. if distance between {_SkyLocation} and {_LastLocation} is less than {_mindist}:
  66. delete {_GoodLocation}
  67. if {_GoodLocation} is true:
  68. set {_GroundLocation} to {_SkyLocation}
  69. while (block at {_GroundLocation}) is air:
  70. if y-coordinate of {_GroundLocation} is less than 5:
  71. delete {_GoodLocation}
  72. stop loop
  73. else:
  74. set {_GroundLocation} to location 1 below {_GroundLocation}
  75. if {_GoodLocation} is true:
  76. if (block at {_GroundLocation}) is not cactus, water, or lava:
  77. set {_LastLocation} to {_SkyLocation}
  78. set {_GroundLocation} to (location 1 above {_GroundLocation})
  79. add {_GroundLocation} to {_FinalLocations.Ground::*}
  80. add {_GroundLocation} to {_FinalLocations::*}
  81. wait 1 tick
  82. stop loop
  83. else:
  84. delete {_GoodLocation}
  85. loop {_AmountOfPlayers} times:
  86. command sender is not online:
  87. broadcast "{@P}{@C} Scatter failed, command sender logged out."
  88. command "/aps random.break"
  89. stop trigger
  90. else:
  91. teleport (command sender) to {_FinalLocations::%loop-number%}
  92. if {_ListOfAllPlayers::%loop-number%} is not online:
  93. broadcast "{@P}{@H} %{_ListOfAllPlayers::%loop-number%}% {@C}- Scheduled"
  94. set {ScatterScheduler::%{_ListOfAllPlayers::%loop-number%}%} to {_FinalLocations::%loop-number%}
  95. else:
  96. broadcast "{@P}{@H} %{_ListOfAllPlayers::%loop-number%}% {@C}- %loop-number%/%{_AmountOfPlayers}%"
  97.  
  98. if {_ListOfAllPlayers::%loop-number%} is equal to (command sender):
  99. set {_CommandSenderLocation} to {_FinalLocations::%loop-number%}
  100. wait 6 ticks
  101. teleport {_ListOfAllPlayers::%loop-number%} to (command sender)
  102. teleport (command sender) to {_CommandSenderLocation}
  103. broadcast "{@P}{@C} Task completed."
  104. delete {Scatter.DisableChunkUnload}
  105. wait 2 ticks
  106. loop 5 times:
  107. command "/aps note.harp"
  108. command "/aps fireworks.launch"
  109. command "/aps fireworks.twinkle"
  110. wait 4 ticks
  111.  
  112.  
  113. #--------------------------------------------------
  114. # End of Scatter - Event section (and sound command)
  115. #--------------------------------------------------
  116.  
  117. on chunk unload:
  118. {Scatter.DisableChunkUnload} is true:
  119. cancel the event
  120. on skript start:
  121. delete {Scatter.DisableChunkUnload}
  122.  
  123. on login:
  124. if {ScatterScheduler::%player%} is set:
  125. wait 5 ticks
  126. broadcast "{@P}{@H} %event-player%{@C} was late scattered!"
  127. teleport player to {ScatterScheduler::%player%}
  128. wait 1 tick
  129. delete {ScatterScheduler::%player%}
Add Comment
Please, Sign In to add comment