Skip to content
RustPluginGenerator

OnEntityActiveCheck

OnEntityActiveCheck is called before the game's IsActiveItem RPC test runs on an entity for a player, letting plugins force the active/usable decision. Returning a bool overrides the built-in result.

Signature
object OnEntityActiveCheck(BaseEntity ent, BasePlayer player, uint id, string debugName)

Parameters

Hook parameters
ParameterTypeDescription
entBaseEntityThe BaseEntity whose activity state is being tested, typically an entity a player is trying to interact with.
playerBasePlayerThe BasePlayer performing the action; both ent.net and player.net are guaranteed non-null at this point.
iduintThe network ID used for the active-item test, usually the player's own net ID but passed through by the caller.
debugNamestringA short string label describing the check, useful for debugging which call path triggered it.

Return value

Return a bool to override the result of the IsActiveItem test; true marks the entity active for that player and false marks it inactive. Return null (or any non-bool value) to let the original ent.net.ID == player.net.ID comparison run unchanged.

How it works

This hook fires inside BaseEntity.RPC_Server/IsActiveItem.Test, the server-side handler for the IsActiveItem RPC. Rust clients send this RPC when they want to know whether an entity is currently active or usable in their context (for example whether an item-related entity should respond to use). Before the vanilla comparison of ent.net.ID against player.net.ID runs, Oxide calls the hook with the entity, the player, the id being tested and a debug label.

The ent and player parameters are the two sides of the check and are already null-checked by the game before the hook fires, so you can rely on both having a network identity. id is the numeric ID the test compares against; in practice it is the player's network ID, but treat it as whatever the caller supplied. debugName is a free-form tag that identifies which system issued the test.

Because the patched method returns bool, a non-null bool return from your hook replaces the vanilla answer entirely: true tells the client the entity is active for this player, false tells it the entity is not. Returning null (or anything that is not a bool) lets the original ent.net.ID == player.net.ID comparison decide. You cannot narrow this hook by declaring a more specific BaseEntity subtype usefully, because every active-check across entities would then be skipped unless it matched.

Example plugin: Force activity checks for a whitelisted player set

ForcedActiveCheck.cs
using System;
using Newtonsoft.Json;
using Oxide.Core;
using UnityEngine;

namespace Oxide.Plugins
{
    [Info("ForcedActiveCheck", "RustPluginGenerator", "1.0.0")]
    [Description("Lets permission holders force the entity active-item test to succeed.")]
    public class ForcedActiveCheck : RustPlugin
    {
        private const string PermUse = "forcedactivecheck.use";

        private PluginConfig config;

        private class PluginConfig
        {
            [JsonProperty("Enable permission override")]
            public bool EnableOverride { get; set; } = true;
        }

        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);

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

        private object OnEntityActiveCheck(BaseEntity ent, BasePlayer player, uint id, string debugName)
        {
            if (!config.EnableOverride || ent == null || player == null) return null;

            if (permission.UserHasPermission(player.UserIDString, PermUse))
            {
                return true;
            }

            return null;
        }
    }
}

This plugin lets permission holders force the active-item test to succeed regardless of the network-ID comparison. OnEntityActiveCheck checks whether the player holds the forcedactivecheck.use permission and, if so, returns true so the client treats the entity as active. All other calls return null so the vanilla comparison runs untouched. The permission is registered in Init, and a short config block gives admins a toggle to disable the override without unloading the plugin. Because the hook fires on client-driven RPCs, it only does a permission lookup and never prints, keeping the path cheap.

Common use cases

  • Grant activity to trusted players

    Let a permission-granted group treat arbitrary entities as active for their account, useful for staff tooling or testing rigs.

  • Debug active-check traffic

    Inspect the debugName and id values during development to understand which systems request active checks and when.

  • Deny activity for specific entities

    Return false for entity types you want to hide from a client interaction system while leaving everything else default.

Pitfalls

  • Overriding every entity is risky

    Returning a bool for all calls bypasses the vanilla network-ID comparison for every entity, which can confuse client interaction logic. Scope your return to specific players or entity types.

  • Hook fires on client RPC traffic

    This path is driven by RPCs sent from clients, so it can fire frequently. Avoid logging or allocation-heavy work inside the hook and keep permission checks cached where possible.

  • Non-bool returns are ignored

    Only a bool return overrides the result. Any other non-null value falls through to the original comparison, so do not return strings or numbers expecting them to take effect.

Build a plugin with OnEntityActiveCheck

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

Prompt: Grant activity to trusted players using the OnEntityActiveCheck 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 OnEntityActiveCheck

Generate