Jump to content

Looping A list


Shadow_UTubes

Recommended Posts

Hello, I am making a queue Skript and already have the queue part done. I would like to have the bolded part of my code replaced by code that teleports everyone in the queue to a different position from set coordinates. If you could give an example (or fix my code for me) that would be great! Thank you so much! :)

 

#Make it teleport all players
command /queue_vilage:
    trigger:
        if {QueueVilage::*} does not contain player:
            add player to {QueueVilage::*}
        else:
            send "&aAlready in queue!"
        loop {QueueVilage::*}:
            add 1 to {_vilagequeue}
            if {_vilagequeue} is 2:
                #code to teleport
            
command /unqueue_vilage:
    trigger:
        remove player from {QueueVilage::*}
        if {QueueVilage::*} contains player:
            subtract 1 from {_vilagequeue}
            send "&cNo longer in queue"
        
command /queue_list_vilage:
    permission: op
    trigger:
        send "&aPeople in the queue: &f%{QueueVilage::*}%"
        
command /queue_vilage_amount:
    permission: op
    trigger:
        send "There are %{_vilagequeue}% people in the queue"
        
command /queue_vilage_reset:
    trigger:
        clear {Variable2::*}
        send "&cCleared the queue!"
    trigger:
        set {_vilagequeue} to 0

Link to comment
Share on other sites

Since you are looping the queue list you could either do:
 

teleport loop-value to location(x, y, z, world "worldName")

or you could do:

teleport {QueueVillage::%loop-index%} to location(x, y, z, world "worldName")

Also, please post this in the correct place next time.

Edited by hotpocket
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...