How to make a queue?

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.
How to make a queue in skript? Queue in pvp arena. Thanks
add player in variables list. if the size is more than or equal that you want example 4. then make a countdown. Example 30 seconds to start. if room is full (8) then just change cool down to 3 seconds. and there you go
 
I don't understand English very well, but from what I understand isn't I need. I want to make a arena that there are people in the queue, and that two people are doing pvp and one who dies leaves and the winner stay in the arena. And the next of the queue enters the game continue against. By order queue.
 
Make a cmd to create set a arena, then, on command like /join, teleport all players to Arena location, then add them to a list. If there were 8 people, take 2 random elements out of the list and make them fight each other. Once somone dies, remove them from the list and teleport them to spawn and so on and so on
 
Plase, make me a example code to understand. I'm learning english hahhaahahah
 
Plase, make me a example code to understand. I'm learning english hahhaahahah

Didn't test

code_language.skript:
function pvpplayerdeath(p: player):
    if {waiting::1} is set:
        set {_newplayer} to player from uuid "%{waiting::1}%"
    if {ingame::1} = "%uuid of {_p}%":
        delete {ingame::1}
    if {ingame::2} = "%uuid of {_p}%":
        delete {ingame::2}
    if {_newplayer} is set:
        if {ingame::1} is not set:
            #ARENA LOCATION 1
            set {_arena} to location 0, 0, 0 in world "world"
            teleport {_newplayer} to {_arena}
            set {ingame::1} to uuid of {_newplayer}
        if {ingame::2} is not set:
            #ARENA LOCATION 2
            set {_arena} to location 0, 0, 0 in world "world"
            teleport {_newplayer} to {_arena}
            set {ingame::2} to uuid of {_newplayer}
            
on death:
    if {ingame::%uuid of victim%} is set:
        pvpplayerdeath(victim)
        if {waiting::*} is not set:
            message "&cThere is no new player in the queue" to attacker
            
on quit:
    if {ingame::1} = "%uuid of player%":
        pvpplayerdeath(player)
        stop
    if {ingame::2} = "%uuid of player%":
        pvpplayerdeath(player)
        stop
    loop {waiting::*}:
        if "%loop-value%" = "%uuid of player%":
            set {_waiting2::*} to {waiting::*}
            delete {waiting::*}
            loop {_waiting2::*}:
                if "%loop-value-2%" is not "%uuid of player%":
                    add loop-value-2 to {waiting::*}
            stop

on script load:
    delete {ingame::*}
    delete {waiting::*}

on join:
    if {ingame::1} = "%uuid of player%":
        delete {ingame::1}
    if {ingame::2} = "%uuid of player%":
        delete {ingame::2}
        
command /join:
    trigger:
        if {ingame::1} = "%uuid of player%":
            stop
        if {ingame::2} = "%uuid of player%":
            stop
        if {ingame::1} is not set:
            #ARENA LOCATION 1
            set {_arena} to location 0, 0, 0 in world "world"
            teleport {_newplayer} to {_arena}
            set {ingame::1} to uuid of player
            stop
        if {ingame::2} is not set:   
            #ARENA LOCATION 2
            set {_arena} to location 0, 0, 0 in world "world"
            teleport {_newplayer} to {_arena}
            set {ingame::2} to uuid of player
            stop
        loop {waiting::*}:
            if "%loop-value%" = "%uuid of player%":
                message "&cYou are already in the queue."
                stop
            add uuid of player to {waiting::*}
            message "&cYou are in the queue"
            
command /leave:
    trigger:
        if {ingame::1} = "%uuid of player%":
            stop
        if {ingame::2} = "%uuid of player%":
            stop
        loop {waiting::*}:
            if "%loop-value%" = "%uuid of player%":
                set {_waiting2::*} to {waiting::*}
                delete {waiting::*}
                loop {_waiting2::*}:
                    if "%loop-value-2%" is not "%uuid of player%":
                        add loop-value-2 to {waiting::*}
                message "&cYou left the queue."
                stop
            message "&cYou are not in the queue."
 
This code is not working. Please help me.
Just create a thread in request section. Help section are for people who needs assistance on how to solve problems in their code. If you're here to be spoon-fed because you have no idea how to make the queue system, then make a thread in request section.
 
Status
Not open for further replies.