Skip to content
RustPluginGenerator

OnConnectionDequeue

OnConnectionDequeue is called when a queued connection is about to be removed from the server's connection queue. Returning a non-null value skips the removal.

Signature
object OnConnectionDequeue(Network.Connection connection)

Parameters

Hook parameters
ParameterTypeDescription
connectionNetwork.ConnectionThe Network.Connection being taken out of the connection queue. Use connection.userid to identify the player and connection.username for the name.

Return value

Returning null lets the server continue and remove the connection from the queue. Any non-null return stops the removal code, so the connection stays in the queue and is processed again, which can leave the player stuck.

How it works

The hook fires inside ConnectionQueue.RemoveConnection, which the server calls when it processes an entry in the connection queue. That happens when a player is dequeued, whether they successfully join, time out, or are dropped because of a full server or a kick. connection is the Network.Connection object the queue is working on; connection.userid is the Steam ID and connection.username the display name, so it is the right place to record which player (by ID) was processed.

Because Oxide checks that every argument matches the declared parameter type, you can declare the parameter as Network.Connection or as a type that Network.Connection derives from. There is no meaningful narrowing here since the only parameter is the connection itself.

This is not a per-tick hook, but it can fire for every disconnect and kick, so avoid chat spam and keep the callback cheap. It is useful for auditing join attempts, logging queue exits, and building per-player connection histories, rather than for changing gameplay.

Example plugin: Log queue exits for admins with a permission

ConnectionDequeueLogger.cs
using System.Collections.Generic;
using Oxide.Core;
using UnityEngine;

namespace Oxide.Plugins
{
    [Info("Connection Dequeue Logger", "RustPluginGenerator", "1.0.0")]
    [Description("Notifies permitted staff when a queued connection is removed from the queue.")]
    public class ConnectionDequeueLogger : RustPlugin
    {
        private const string PermSee = "connectiondequeuelogger.see";

        protected override void LoadDefaultMessages()
        {
            lang.RegisterMessages(new Dictionary<string, string>
            {
                ["Dequeued"] = "{0} ({1}) left the connection queue."
            }, this);
        }

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

        private void Init()
        {
            permission.RegisterPermission(PermSee, this);
        }

        private object OnConnectionDequeue(Network.Connection connection)
        {
            if (connection == null || string.IsNullOrEmpty(connection.userid.ToString()))
            {
                return null;
            }

            string name = string.IsNullOrEmpty(connection.username) ? "Unknown" : connection.username;
            string id = connection.userid.ToString();
            string message = Msg("Dequeued", null, name, id);

            foreach (BasePlayer staff in BasePlayer.activePlayerList)
            {
                if (staff == null || !staff.IsConnected)
                {
                    continue;
                }

                if (permission.UserHasPermission(staff.UserIDString, PermSee))
                {
                    staff.ChatMessage(message);
                }
            }

            Interface.Oxide.LogDebug(string.Format("{0} dequeued with id {1}", name, id));
            return null;
        }
    }
}

The plugin registers a permission, connectiondequeuelogger.see, and uses OnConnectionDequeue to notify permitted staff when a connection leaves the queue. When the hook fires it iterates BasePlayer.activePlayerList, skips null or disconnected players, and sends the localized Dequeued chat message to each connected player who has the permission. It also writes a debug line through Interface.Oxide.LogDebug with the connection's name and user ID. The hook returns null, so the queue's default behavior is unchanged. It guards against connection == null and empty user IDs before doing anything.

Common use cases

  • Audit join attempts

    Record queued connection IDs and names to review which accounts are hitting the server and when they drop out.

  • Notify staff of queue exits

    Send a localized chat notice to online admins with the permission when a player is removed from the connection queue.

  • Feed a connection history

    Append dequeue timestamps to a data file so staff can compare queue activity against player reports.

Pitfalls

  • Return value halts removal

    Returning anything other than null skips the queue removal entirely. Keep the hook returning null unless you deliberately want the connection to stay queued.

  • Players may be offline

    Dequeue happens at the same moment a player leaves, so BasePlayer.FindByID may return null; guard against that or use connection.userid directly.

  • Not a per-tick hook but still frequent

    Avoid Puts or PrintWarning inside the hook since it can fire during busy server restarts and reconnect storms; send notices only to permitted players.

Build a plugin with OnConnectionDequeue

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

Prompt: Audit join attempts using the OnConnectionDequeue 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 OnConnectionDequeue

Generate