Advertisement
fleft17

Untitled

Oct 25th, 2014
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.05 KB | None | 0 0
  1. options:
  2.  
  3.  
  4. #--------------------------------------------------
  5. # Options
  6. #--------------------------------------------------
  7.  
  8. P: §f[§7Scatter]
  9. # Prefix for scatter messages
  10.  
  11. H: §9
  12. # Chat color when there's **x** seconds, **player**, misc
  13.  
  14. C: §f
  15. # Main chat color
  16.  
  17. Tries: 1001
  18. # Limit to how many times the Skript will attempt to load a given location
  19.  
  20. #--------------------------------------------------
  21. # Command
  22. #--------------------------------------------------
  23.  
  24. command /scatterall [<world>] [<integer>] [<text>]:
  25. permission: skript.fleftscatter
  26. trigger:
  27.  
  28. if arg-3 is "all" or "*":
  29. set {_ListOfAllPlayers::*} to all players
  30. set {_AmountOfPlayers} to (size of {_ListOfAllPlayers::*})
  31. loop {_ListOfAllPlayers::*}:
  32. add 1 to {_count}
  33. set {_ListOfAllPlayers::%{_count}%} to loop-value
  34. if (size of ({_ListOfAllPlayers::*})) is equal to 0:
  35. message "{@P}{@C} No one can be scattered!"
  36. stop trigger
  37. set {Scatter.DisableChunkUnload} to true
  38. set {_world} to arg-1
  39. set {_radius} to arg-2
  40. set {_mindist} to (({_radius}/{_AmountOfPlayers})*3)
  41. broadcast "{@P}{@C} Attempting to scatter {@H}%{_AmountOfPlayers}%{@C} players!"
  42. loop {_AmountOfPlayers} times:
  43. loop {@Tries} times:
  44. if loop-number-2 is equal to {@Tries}:
  45. broadcast "{@P}{@C} Could not scatter %loop-number-1%/%{_AmountOfPlayers}%"
  46. broadcast "{@P}{@C} Some players may have been scattered!"
  47. broadcast "{@P}{@C} You may want to /tpall!"
  48. command "/aps random.break"
  49. delete {Scatter.DisableChunkLoading}
  50. stop trigger
  51. set {_GoodLocation} to true
  52. 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})
  53. loop ((loop-number-1)-1) times:
  54. if {_GoodLocation} is true:
  55. distance between {_SkyLocation} and {_FinalLocations.Sky::%loop-number-3%} is less than {_mindist}:
  56. delete {_GoodLocation}
  57. if {_GoodLocation} is true:
  58. set {_GroundLocation} to {_SkyLocation}
  59. while (block at {_GroundLocation}) is air:
  60. if y-coordinate of {_GroundLocation} is less than 5:
  61. delete {_GoodLocation}
  62. stop loop
  63. set {_GroundLocation} to location 1 below {_GroundLocation}
  64. if {_GoodLocation} is true:
  65. if (block at {_GroundLocation}) is cactus, water, or lava:
  66. delete {_GoodLocation}
  67. if {_GoodLocation} is true:
  68. set {_GroundLocation} to (location 1 above {_GroundLocation})
  69. add {_GroundLocation} to {_FinalLocations.Ground::*}
  70. add {_GroundLocation} to {_FinalLocations::*}
  71. wait 1 tick
  72. stop loop
  73. loop {_AmountOfPlayers} times:
  74. add 1 to {_Scattered}
  75. else if {_Scattered} is equal to ({_AmountOfPlayers}/2):
  76. broadcast "{@P}{@C} 50%% done!
  77. command sender is not online:
  78. broadcast "{@P}{@C} Scatter failed, command sender logged out."
  79. command "/aps random.break"
  80. stop trigger
  81. else:
  82. set {_FinalLocation} to {_FinalLocations::%loop-number%}
  83. remove {_FinalLocation} from {_FinalLocations::*}
  84. teleport (command sender) to {_FinalLocation}
  85. if {_ListOfAllPlayers::%loop-number%} is equal to (command sender):
  86. set {_CommandSenderLocation} to {_FinalLocation}
  87. wait 5 ticks
  88. teleport {_ListOfAllPlayers::%loop-number%} to (command sender)
  89. if {_CommandSenderLocation} is set:
  90. teleport (command sender) to {_CommandSenderLocation}
  91. broadcast "{@P}{@C} All players scattered"
  92. delete {Scatter.DisableChunkUnload}
  93. loop 10 times:
  94. command "/aps note.harp"
  95. command "/aps fireworks.launch"
  96. command "/aps fireworks.twinkle"
  97. wait 2 ticks
  98.  
  99.  
  100. #--------------------------------------------------
  101. # End of Scatter - Event section (and sound command)
  102. #--------------------------------------------------
  103.  
  104. on chunk unload:
  105. {Scatter.DisableChunkUnload} is true:
  106. cancel the event
  107. on skript start:
  108. delete {Scatter.DisableChunkUnloading}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement