Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- options:
- Prefix: &8[&bFavonius&8]&r
- MaxTries: 1001
- ChunkWaitTicks: 10
- ScatterWaitTicks: 1
- # variables
- # {Teams::*} - list of integer - all team numbers currently active
- # {Team.%integer%.Set} - true/null - Team created?
- # {Team.%integer%::*} - list of "text" - player names in that team (TEXT!)
- # {Teams.InTeam::%player%} - integer/null - what team is player in?
- command /scatterteams <world> <integer> <integer>:
- usage: /scatterteams <world> <radius> <mindist>
- permission: skript.teams
- trigger:
- set {_Count} to 0
- loop {Teams::*}:
- {Team.%loop-value%::*} is set
- increase {_Count} by 1
- add {_Count} to {_Scatter.Teams::*}
- set {_Scatter.Team.%{_Count}%::*} to {Team.%loop-value%::*}
- loop all players:
- {Teams.InTeam::%loop-player%} is not set
- add (name of loop-player) to {_Solos::*}
- broadcast "&7-----------------------------------"
- broadcast "{@Prefix} Teams are being scattered!"
- set {_Size} to ((size of {_Scatter.Teams::*})+(size of {_Solos::*}))
- # this is copied from the above scatter
- loop {_Size} times:
- loop {@MaxTries} times:
- if loop-number-2 is equal to {@MaxTries}:
- message "{@Prefix} Could not get position &7[&f%loop-number-1%&9/&f%{_Size}%&7]"
- command "/scatter-playsound random.break"
- stop trigger
- set {_ThisLocation.Okay} to true
- set {_ThisLocation.Sky} to (the location at ((random integer between (0-(arg 2)) and ((arg 2)-1))+0.5), 255, ((random integer between (0-(arg 2)) and ((arg 2)-1))+0.5) of the world (arg 1))
- loop ((loop-number-1)-1) times:
- {_ThisLocation.Okay} is true
- distance between {_ThisLocation.Sky} and {_FinalLocation.Sky::%loop-number-3%} is less than (arg 3)
- delete {_ThisLocation.Okay}
- if {_ThisLocation.Okay} is true:
- set {_ThisLocation.Ground} to {_ThisLocation.Sky}
- while (block at {_ThisLocation.Ground}) is air:
- if y-coordinate of {_ThisLocation.Ground} is less than 4:
- delete {_ThisLocation.Okay}
- stop loop
- set {_ThisLocation.Ground} to location 1 below {_ThisLocation.Ground}
- if {_ThisLocation.Okay} is true:
- if (block at {_ThisLocation.Ground}) is lava, water or cactus:
- delete {_ThisLocation.Okay}
- if {_ThisLocation.Okay} is true:
- set {_FinalLocation.Sky::%loop-number-1%} to {_ThisLocation.Sky}
- set {_FinalLocation.Ground::%loop-number-1%} to (location 1 above {_ThisLocation.Ground})
- stop loop
- set {Scatter.DisableChunkUnloading} to true
- set {_ApproxTime} to {_Size}*{@ChunkWaitTicks}/20
- broadcast "{@Prefix} Scatter will take &a%{_ApproxTime}%&r seconds!"
- loop {_Size} times:
- if command sender is not online:
- broadcast "{@Prefix} Operation failed, chunkloading player logged out."
- command "/scatter-playsound random.break"
- stop trigger
- teleport (command sender) to {_FinalLocation.Ground::%loop-number%}
- message "{@Prefix} &aLoading: &7[&a%loop-number%&7/&b%{_Size}%&7]" to command sender
- wait {@ChunkWaitTicks} ticks
- broadcast "&7-----------------------------------"
- wait 40 ticks
- set {_TeamSize} to (size of {_Scatter.Teams::*})
- set {_SoloSize} to (size of {_Solos::*})
- set {_PositionCount} to 0
- set {_TeamCount} to 0
- set {_SoloCount} to 0
- loop {_Scatter.Teams::*}:
- increase {_PositionCount} by 1
- increase {_TeamCount} by 1
- loop {_Scatter.Team.%loop-value%::*}:
- set {_Player} to ("%loop-value-2%" parsed as offlineplayer)
- if {_Player} is not online:
- broadcast "{@Prefix} Scheduled late scatter of &a%{_Player}%."
- set {ScatterScheduler::%{_Player}%} to {_FinalLocation.Ground::%{_PositionCount}%}
- else:
- teleport {_Player} to {_FinalLocation.Ground::%{_PositionCount}%}
- execute console command "/sall note.bass 1"
- wait {@ScatterWaitTicks} ticks
- loop {_Solos::*}:
- increase {_PositionCount} by 1
- increase {_SoloCount} by 1
- set {_Player} to ("%loop-value%" parsed as offlineplayer)
- if {_Player} is not online:
- broadcast "{@Prefix} Scheduled late scatter of &a%{_Player}%!"
- set {ScatterScheduler::%{_Player}%} to {_FinalLocation.Ground::%{_PositionCount}%}
- else:
- teleport {_Player} to {_FinalLocation.Ground::%{_PositionCount}%}
- wait {@ScatterWaitTicks} ticks
- broadcast "{@Prefix} All teams scattered!"
- broadcast "&7-----------------------------------"
- execute console command "/sall random.successful_hit 0.5"
- delete {Scatter.DisableChunkUnloading}
- on chunk unload:
- {Scatter.DisableChunkUnloading} is true
- cancel the event
- on skript start:
- delete {Scatter.DisableChunkUnloading}
- on join:
- {ScatterScheduler::%player%} is set
- teleport player to {ScatterScheduler::%player%}
- delete {ScatterScheduler::%player%}
- broadcast "{@Prefix}&r Scheduled late-scatter of &a%player%!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement