How to make it so you can join and leave mid 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 comminuty!

    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.

Jake Allen

Member
Nov 28, 2022
1
0
1
23
ok so im making this queue system for a minigame recreation called BattleBox.
so far i can join queue and it says how many players are in queue and all of that but if i try and leave queue the count down keeps going in chat and the titles keep popping up pls help. Also feel free to mess around with this and send me a better version of this but the same idea thanks <3.

Code:
# tbh idky i have this variable

variables:
  {queue.player} = 0


# this is just a kill effect thing it works fine for the most part
on death of player:
    send title "&f[&a&f]&c %victim%" to attacker for 3 seconds
    launch ball colored yellow at attacker's location with duration 1

#command to queue into a game
command /battleboxqueue:
  trigger:
# this is to make sure player is in queue and counts as a player in queue
    if {queue} does not contain player:
      add player to {queue.player}
      add 1 to {queue.player}
      set {queue} to true
    else:
      remove 1 from {queue}
      remove player from {queue.player}
# now this part here vvvvv makes a count down from 20 seconds and titles show up and sounds are played and countdown in chat
    teleport player to spawn of world "BattleBox1"
    play sound "entity.experience_orb.pickup" with volume 0.5 to the player
    send title "&a20 seconds to match start" to player for 3 seconds
    broadcast "&a20 seconds to match start!"
    broadcast "&e(&b%{queue.player}%&e/&b12&e) %player% has joined &6Battle Box"
    wait 10 seconds
    send title "&a10 seconds" to player
    broadcast "&a10 seconds to match start!"
    play sound "entity.experience_orb.pickup" with volume 0.5 to the player
    wait 5 seconds
    send title "&a5 seconds" to player
    broadcast "&a5 seconds to match start!"
    play sound "entity.experience_orb.pickup" with volume 0.5 to the player
    wait 1 seconds
    send title "&a4 seconds" to player
    broadcast "&a4 seconds to match start!"
    play sound "entity.experience_orb.pickup" with volume 0.5 to the player
    wait 1 seconds
    send title "&a3 seconds" to player
    broadcast "&a3 seconds to match start!"
    play sound "entity.experience_orb.pickup" with volume 0.5 to the player
    wait 1 seconds
    send title "&a2 seconds" to player
    broadcast "&a2 seconds to match start!"
    play sound "entity.experience_orb.pickup" with volume 0.5 to the player
    wait 1 seconds
    send title "&a1 second" to player for 1 seconds
    broadcast "&a1 second to match start!"
    play sound "entity.experience_orb.pickup" with volume 0.5 to the player
    wait 1 seconds
    delete {queue}

# this is supposed to make the player leave the queue but it redoes the other command from b4 and I just want this so the player leaves queue and stops the titles from showing and stops the countdown in chat
command /battleboxqueueleave:
  trigger:
    if {queue} = true:
      remove player from {queue}
      remove 1 from {queue}
      set {queue} to false
    else:
      stop
[doublepost=1669626201,1669625918][/doublepost]I am also using a skript addon called Skellet < only addon of skript i have and also this is supposed to be working on a server version 1.18.2
 
I found a problem, not sure if it's what you are looking for, but look here. What do you see here that might not work out?
[doublepost=1669658034,1669657653][/doublepost]Also, the reason the messages are still sending is that there's nothing to stop the messages from being sent. you'd have to make if statements after every wait statement.
[doublepost=1669658897][/doublepost]Also, you might want to change {queue.player} to {queue::*}, the ::* makes the variable a list, allowing it to contain a list of things.
 

Attachments

  • queue.png
    queue.png
    15 KB · Views: 78
Status
Not open for further replies.