I have wrote the simple basics of my beginner queue skript where players can join a queue and when enough players are in that queue, it will begin a countdown and teleport all players somewhere.
My problem is that all the players teleport to the same spot when I want them to be teleported to different areas within a certain location.
Here is my code.
The code is very basic right now, being limited to only one queue. I thought it would be a good idea to start with the easy stuff and continue later on.
The part where it teleports all people is this section.
How can I change it to teleport each loop-value to a random location within a certain area?
My problem is that all the players teleport to the same spot when I want them to be teleported to different areas within a certain location.
Here is my code.
code_language.skript:
on script load:
set {queue1} to 0
delete {queue::*}
command /reset:
trigger:
delete {queue::*}
set {queue1} to 0
command /setloc:
trigger:
set {spawn} to location of player
command /queue [<text="check">]:
usage: You can either use &c/queue join &for &c/queue leave
trigger:
if arg-1 is "check":
send "&cThere are &e%{queue1}%/16 &cplayers in the queue!" to player
if arg-1 is "join":
if {queue1} >= 8:
execute console command "/queue start"
if {queue1} >= 16:
send "&cThe queue is full!" to player
else if "%{queue::*}%" contains "%player%":
send "&cYou are already in the queue!" to player
else:
add 1 to {queue1}
add "%player%" to {queue::*}
set {queue.%player%} to 1
broadcast "&cThere are now &e%{queue1}%/16 &cplayers in the queue!"
if executor is console:
if arg-1 is "start":
if {queue1} >= 8:
broadcast "&eThe match is about to start!"
broadcast "&cThe match will begin in &e15 seconds.."
wait 10 seconds
broadcast "&cThe match will begin in &e5 seconds.."
wait 1 seconds
broadcast "&cThe match will begin in &e4 seconds.."
wait 1 seconds
broadcast "&cThe match will begin in &e3 seconds.."
wait 1 seconds
broadcast "&cThe match will begin in &e2 seconds.."
wait 1 seconds
broadcast "&cThe match will begin in &e1 seconds.."
wait 1 second
broadcast "&eTeleporting players.."
loop {queue::*}:
teleport loop-value parsed as player to {spawn}
delete {queue::*}
delete {queue1}
else:
send "&cNot enough players to start!" to player
if arg-1 is "leave":
if {queue.%player%} is 1:
remove 1 from {queue1}
send "&cYou have been removed from the queue!"
broadcast "&cThere are now &e%{queue1}%/16 &cplayers in the queue!"
remove "%player%" from {queue::*}
else:
send "&cYou are not currently in a queue!"
command /test:
trigger:
send "%{queue::*}%" to player
send "%{queue1}%" to player
command /test2:
trigger:
add 1 to {queue1}
broadcast "&cThere are now &e%{queue1}%/16 &cplayers in the queue!"
on death:
if {queue.%player%} is 1:
remove 1 from {queue1}
set {queue.%player%} to 0
if {queue1} is 0:
broadcast "&cThe game is now over!"
broadcast "&cUse &e/queue join &cto join the next queue!"
on join:
set {queue.%player%} to 0
The code is very basic right now, being limited to only one queue. I thought it would be a good idea to start with the easy stuff and continue later on.
The part where it teleports all people is this section.
code_language.skript:
loop {queue::*}:
teleport loop-value parsed as player to {spawn}
How can I change it to teleport each loop-value to a random location within a certain area?