Skip to content
untroublee edited this page Nov 11, 2024 · 7 revisions

uQueueService Methods

.new(queueParams : {}) -> Queue

Creates a new Queue object.

:GetTeleportData() -> any

If IsGamePlace is checked, this method will try to find any teleport data associated with this server's private server id.

:GetQueueById(id : string | number) -> Queue

Returns a Queue by its id provided in the params at creation. Returns nil if queue is not found.

:GetQueues() -> {}

Returns an array of all active Queues

Queue Parameters

MinimumPlayers: number?,

Decides how many players the Queue needs to start counting down

MaximumPlayers: number?,

Decides how many players the Queue can hold

PlaceId: number?,

Decides where the players in the Queue will be teleported when initiated

Countdown: number?,

Decides how long the countdown for the Queue is

TeleportData: any?,

Decides the data that will be sent to the target place when Queue is initiated

Id: (string|number)?

Decides the queue's ID, can be used with :GetQueueById()

Queue Events

PlayerAdded -> plr : Player

Fires when a Player is added to the Queue.

PlayerRemoved -> plr : Player

Fires when a Player is removed from the Queue.

Initiated

Fires when a Queue is initated (finished counting down / method :Initiated() called)

CountTick -> newCount : number

Fires when a Queue's countdown has counted down one whole number

Queue Methods

:AddPlayer(plr : Player) -> boolean

Adds a player to the Queue. Returns true if added, returns false if failed.

:RemovePlayer(plr : Player) -> boolean

Removes a player from the Queue. Returns true if removed, returns false if failed.

:Initiate() -> ()

Initiates the Queue. If place id is provided, it will teleport all players to that place.

:Destroy() -> ()

Destroys the Queue. The queue will not be usable after this.

Queue Properties

queued : {}

  • A table containing every player inside of the queue.

placeId

  • The provided value from params on creation.
  • If provided, players will teleport to this place on initation.
  • If no value is provided, players will not be teleported on initiation.

minPlayers

  • The provided value from params on creation.
  • If provided, the minimum amount of players needed for the countdown to start will be this value.
  • If no value is provided, this value defaults to 1

maxPlayers

  • The provided value from params on creation.
  • If provided, the maximum amount of players that can be in the Queue will be this value.
  • If no value is provided, this value defaults to 50

tpData

  • The provided value from params on creation.
  • If provided, the teleport data of the Queue will be this value.
  • If not provided, this value defaults to nil
  • Insert PlayerAmt element into tpData When a Queue is initiated, uQueueService will insert another element into the tpData table if provided, named PlayerAmt. This is just how many players were in the queue when the queue was initiated.
  • DefaultData table At the top of the uQueueService module, you will find a table named DefaultData This can be edited so that when testing your game place, you will be able to experiment with custom teleport data

countdown

  • The provided value from params on creation.
  • If provided, the countdown value of the Queue will be this value.
  • If not provided, this value defaults to 5.

Do not edit:

_uniqueId

  • Immutable id for all queues.