fleft17

Untitled

Oct 25th, 2014
301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.70 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: v2 - FFA only
  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.  
  37. command sender is player:
  38. command "/aps mob.enderdragon.growl"
  39. wait 25 ticks
  40. set {_ListOfAllPlayers::*} to all players
  41. set {_AmountOfPlayers} to (size of {_ListOfAllPlayers::*})
  42. loop {_ListOfAllPlayers::*}:
  43. add 1 to {_count}
  44. set {_ListOfAllPlayers::%{_count}%} to loop-value
  45. set {Scatter.DisableChunkUnload} to true
  46. set {_world} to arg-1
  47. set {_radius} to arg-2
  48. set {_mindist} to (({_radius}/{_AmountOfPlayers})*3)
  49. broadcast "{@P}{@C} Attempting to scatter {@H}%{_AmountOfPlayers}%{@C} players."
  50. loop {_AmountOfPlayers} times:
  51. loop {@Tries} times:
  52. if loop-number-2 is equal to {@Tries}:
  53. broadcast "{@P}{@C} Could not scatter %loop-number-1%/%{_AmountOfPlayers}%."
  54. broadcast "{@P}{@C} Some players may have been scattered!"
  55. command "/aps random.break"
  56. delete {Scatter.DisableChunkLoading}
  57. stop trigger
  58. set {_GoodLocation} to true
  59. 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})
  60. loop ((loop-number-1)-1) times:
  61. if distance between {_SkyLocation} and {_LastLocation} is less than {_mindist}:
  62. delete {_GoodLocation}
  63. if {_GoodLocation} is true:
  64. set {_GroundLocation} to {_SkyLocation}
  65. while (block at {_GroundLocation}) is air:
  66. if y-coordinate of {_GroundLocation} is less than 5:
  67. delete {_GoodLocation}
  68. stop loop
  69. set {_GroundLocation} to location 1 below {_GroundLocation}
  70. if {_GoodLocation} is true:
  71. if (block at {_GroundLocation}) is cactus, water, or lava:
  72. delete {_GoodLocation}
  73. if {_GoodLocation} is true:
  74. set {_LastLocation} to {_SkyLocation}
  75. set {_GroundLocation} to (location 1 above {_GroundLocation})
  76. add {_GroundLocation} to {_FinalLocations.Ground::*}
  77. add {_GroundLocation} to {_FinalLocations::*}
  78. wait 1 tick
  79. stop loop
  80. loop {_AmountOfPlayers} times:
  81. command sender is not online:
  82. broadcast "{@P}{@C} Scatter failed, command sender logged out."
  83. command "/aps random.break"
  84. stop trigger
  85. else:
  86. teleport (command sender) to {_FinalLocations::%loop-number%}
  87. if {_ListOfAllPlayers::%loop-number%} is not online:
  88. broadcast "{@P}{@H} %{_ListOfAllPlayers::%loop-number%}% {@C}- Scheduled"
  89. #set {_player} to {_ListOfAllPlayers::%loop-number%} parsed as player
  90. set {ScatterScheduler::%{_ListOfAllPlayers::%loop-number%}%} to {_FinalLocations::%loop-number%}
  91. else:
  92. broadcast "{@P}{@H} %{_ListOfAllPlayers::%loop-number%}% {@C}- %loop-number%/%{_AmountOfPlayers}%"
  93.  
  94. if {_ListOfAllPlayers::%loop-number%} is equal to (command sender):
  95. set {_CommandSenderLocation} to {_FinalLocations::%loop-number%}
  96. wait 5 ticks
  97. teleport {_ListOfAllPlayers::%loop-number%} to (command sender)
  98. teleport (command sender) to {_CommandSenderLocation}
  99. broadcast "{@P}{@C} Task completed."
  100. delete {Scatter.DisableChunkUnload}
  101. wait 2 ticks
  102. loop 5 times:
  103. command "/aps note.harp"
  104. command "/aps fireworks.launch"
  105. command "/aps fireworks.twinkle"
  106. wait 4 ticks
  107.  
  108.  
  109. #--------------------------------------------------
  110. # End of Scatter - Event section (and sound command)
  111. #--------------------------------------------------
  112.  
  113. on chunk unload:
  114. {Scatter.DisableChunkUnload} is true:
  115. cancel the event
  116. on skript start:
  117. delete {Scatter.DisableChunkUnloading}
  118.  
  119. on login:
  120. if {ScatterScheduler::%player%} is set:
  121. wait 5 ticks
  122. broadcast "{@P}{@H} %event-player%{@C} was late scattered!"
  123. teleport player to {ScatterScheduler::%player%}
  124. wait 1 tick
  125. delete {ScatterSchedule::%event-player%}
Add Comment
Please, Sign In to add comment