Skip to main content
Exports let other resources interact with n4_queue. All exports are server-side only; the queue has no client exports.

Server exports overview


HandleConnection (manual connection)

When queue:manual_connection is 1, you must call this export from your own playerConnecting handler after your checks (bans, whitelists, etc.). The queue then takes over the rest of the connection flow. Signature: HandleConnection(name, source, deferrals, identifier?)
  • name (required) — Player name from the connection event.
  • source (required) — Player server id (source from playerConnecting).
  • deferrals (required) — Deferrals table from the connection callback.
  • identifier (optional) — Primary identifier for the player (e.g. license2:xxx). If omitted, the queue will attempt to resolve it internally.

Discord exports

Only apply when Discord integration is enabled (queue:discord:enabled = 1).
  • GetDiscordUser / GetDiscordUserBySource — Look up cached Discord user data (e.g. username, nickname, avatar, roles) by primary identifier or by source.
  • AddDiscordPrioRole / RemoveDiscordPrioRole — Add or remove a Discord role → priority points entry at runtime without editing config.
  • AddWhitelistRoleId / RemoveWhitelistRoleId — Add or remove a role ID from the Discord whitelist at runtime.

Bypass identifiers

Players whose identifier is in the bypass list skip the queue and can use reserved slots. When the server is full, they are still queued like everyone else.
  • AddBypassIdentifier(identifier)identifier must be a full identifier string (e.g. license2:xxx, discord:yyy). No duplicates added.
  • RemoveBypassIdentifier(identifier) — Removes that identifier from the bypass list.

Queue state

  • IsPlayerInQueue(identifier) — Returns true if a player with that primary identifier is currently in the queue, false otherwise.
  • GetPlayerPosition(identifier) — Returns a table with position (1-based) and totalInQueue, or nil if the player is not in the queue.
  • GetQueueLength() — Returns the current number of players in the queue.
  • GetPlayerPriorityPoints(identifier) — Returns the priority points for that player if they are in the queue, or nil if not.
  • GetTopQueuePlayers(count?) — Returns the top count players (default 10) in the queue. Each entry has priorityPoints, username, and avatar.
  • GetEstimatedWaitString(position, startupDelay) — Returns a human-readable estimated wait (e.g. "2m 30s") for someone at the given queue position. Uses startupDelay (seconds) when the server is still in startup; otherwise uses recent advance history. Returns nil when an estimate cannot be computed.
  • GetConnectingPlayersCount() — Returns how many players are currently in the connecting state (past the queue, not yet fully loaded in).

Grace priority

Grace priority gives a player temporary priority points when they next connect (e.g. after a crash or disconnect). The queue uses queue:grace_priority_points and queue:grace_priority_timer for the actual points and duration unless you only set expiry.
  • SetGracePriority(identifier, durationSeconds) — Grant grace priority for durationSeconds seconds. Pass 0 or a negative number to clear.
  • GetGracePriorityExpiry(identifier) — Returns the Unix timestamp when grace expires, or nil if the player has no grace priority.
  • RemoveGracePriority(identifier) — Remove grace priority (e.g. as an admin action).

Locale

  • Locale(key, …) — Returns the localized string for key (same keys as the queue UI). Extra arguments are used for formatting (e.g. Locale('card_position', position, queueLength, points)).

GetQueueConfig

  • GetQueueConfig() — Returns a read-only table with the current queue configuration (e.g. reserved_slots, max_slots, stack_priority, grace_priority_enabled, grace_priority_points, grace_priority_timer, connection_delay, server_startup_delay, modify_hostname, queue_list_display). Useful for other resources that need to respect queue limits or display info.

Client exports

n4_queue does not expose any client exports. All logic runs on the server; nothing from this resource runs on the client.