Skip to content
RustPluginGenerator

OnQueueUpdate

OnQueueUpdate is called when the server is about to send a queue position update to a connecting player (ConnectionQueue.SendQueueUpdate). Returning a non-null value cancels the vanilla QueueUpdate packet.

Signature
object OnQueueUpdate(Network.Connection connection, int position)

Parameters

Hook parameters
ParameterTypeDescription
connectionNetwork.ConnectionThe Network.Connection of the player waiting in the server queue. Use it to read the player's Steam ID and endpoint before they have a BasePlayer.
positionintThe 1-based place the player occupies in the connection queue. Position 1 is next to be let in.

Return value

Return null to let the default QueueUpdate packet be written. Return any non-null object to skip the vanilla SendQueueUpdate write for that call; the return value itself is not used by the game.

How it works

The hook fires inside ConnectionQueue.SendQueueUpdate, which runs while a player is held in the connection queue before they spawn. Each call corresponds to one queue update packet for one Network.Connection, with position being that connection's current place in line. Using connection.userid and connection.connection you can identify the client without an entity. Because the packet is sent through Net.sv.StartWrite(), the hook fires shortly before the network write, not on every frame of the queue.

Declaring Network.Connection is required; there is no narrower type to substitute, so Oxide dispatches every queue update to your method. Returning anything non-null skips the vanilla write, which means the player receives no position update for that tick. The queue itself keeps ticking and SendQueueUpdate will be called again on subsequent updates, so a one-time block does not remove the player.

Practical use is limited to gating or replacing the packet: harmless suppression for clients you do not want receiving queue data, or observation for logging/telemetry of queue positions before the player has finished connecting.

Example plugin: Reorder queue updates so VIPs see their real position first

QueueUpdateHighlighter.cs
using System.Linq;
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Oxide.Core;
using UnityEngine;

namespace Oxide.Plugins
{
    [Info("Queue Update Highlighter", "RustPluginGenerator", "1.0.0")]
    [Description("Notifies whitelisted players of their position in the connection queue.")]
    public class QueueUpdateHighlighter : RustPlugin
    {
        private PluginConfig config;
        private readonly Dictionary<ulong, int> lastPositions = new Dictionary<ulong, int>();

        private class PluginConfig
        {
            [JsonProperty("VIP Steam IDs")]
            public List<ulong> VipIds = new List<ulong>();
        }

        protected override void LoadDefaultConfig() => config = new PluginConfig();

        protected override void LoadConfig()
        {
            base.LoadConfig();
            try
            {
                config = Config.ReadObject<PluginConfig>();
                if (config == null) throw new Exception();
            }
            catch
            {
                PrintWarning("Configuration file is invalid, using defaults");
                LoadDefaultConfig();
            }
            SaveConfig();
        }

        protected override void SaveConfig() => Config.WriteObject(config);

        protected override void LoadDefaultMessages()
        {
            lang.RegisterMessages(new Dictionary<string, string>
            {
                ["QueuePosition"] = "You are queued at position {0} of the server. Thanks for waiting.",
                ["QueueTop"] = "You are next in the queue, hang tight."
            }, this);
        }

        private string Msg(string key, string userId = null, params object[] args)
            => string.Format(lang.GetMessage(key, this, userId), args);

        private object OnQueueUpdate(Network.Connection connection, int position)
        {
            if (connection == null) return null;

            ulong userId = connection.userid;
            if (userId == 0 || !config.VipIds.Contains(userId)) return null;

            int reported;
            if (lastPositions.TryGetValue(userId, out reported) && reported == position) return null;
            lastPositions[userId] = position;

            var player = BasePlayer.FindByID(userId);
            if (player != null && player.IsConnected)
            {
                player.ChatMessage(position <= 1 ? Msg("QueueTop", player.UserIDString) : Msg("QueuePosition", player.UserIDString, position));
            }

            return null;
        }

        private void Unload()
        {
            lastPositions.Clear();
        }
    }
}

The plugin keeps a set of Steam IDs configured in VIPIds. In OnQueueUpdate it looks up the connection's Steam ID and, if the player is a VIP and their reported position differs from what they were last told, it sends them a chat message through connection before returning null so vanilla still writes the queue packet. Non-VIPs are ignored with a plain null, keeping the hook cheap because it runs for every queued client. LoadDefaultConfig seeds a default list, and SaveConfig persists edits. Chat text is registered in LoadDefaultMessages so wording is localisable.

Common use cases

  • Log queue positions for admins

    Record each connection's Steam ID and position when OnQueueUpdate fires to spot players stuck in the queue for too long.

  • Suppress queue packets for a specific client

    Return a non-null value to skip the vanilla write for connections matching a condition, without removing them from the queue.

  • Apply a VIP notification

    Read connection.userid and send a chat message to whitelisted players the first time they enter a new queue slot.

Pitfalls

  • No BasePlayer available

    The player is not spawned yet; only Network.Connection members such as userid and connection are usable, not BasePlayer.FindByID.

  • Returning a value does not kick

    A non-null return only suppresses this update packet; the connection remains in the queue and the hook will fire again on the next cycle.

  • Runs for every queued client

    Do not print warnings or allocate per call; the hook fires during connect bursts and every call adds latency to the queue with a full server.

Build a plugin with OnQueueUpdate

Describe what should happen and get a compiled plugin that uses this hook.

Prompt: Log queue positions for admins using the OnQueueUpdate hook, with a config file and a permission
Generate this plugin

Edit the prompt on the next screen. 2 free plugins a month, no card.

Last updated Oct 26, 2026. Found a mistake? Email support@rustplugingenerator.com.

Build a plugin with OnQueueUpdate

Generate