Skip to content
RustPluginGenerator

OnLootNetworkUpdate

OnLootNetworkUpdate is called right before the server sends a loot panel network update to a player, whenever PlayerLoot.SendUpdate runs while their loot UI is opening or refreshing.

Signature
object OnLootNetworkUpdate(PlayerLoot playerLoot)

Parameters

Hook parameters
ParameterTypeDescription
playerLootPlayerLootThe PlayerLoot instance whose network update is about to be sent. Use playerLoot.baseEntity to get the BasePlayer owner, and playerLoot.entitySource / playerLoot.itemSource to inspect what they are looting.

Return value

Returning null lets the method proceed and send the loot update normally. Returning any non-null object (for example true) stops SendUpdate before the PlayerUpdateLoot message is created, so the client receives no update for that call.

How it works

This hook fires from PlayerLoot.SendUpdate, the private method that builds and sends the PlayerUpdateLoot network message that fills a player's loot panel. It runs when the loot UI is being pushed to the client: after a player starts looting a container, corpse, dropped bag or another player, and on subsequent refreshes of that session. The single parameter, PlayerLoot, exposes baseEntity (the looting player), entitySource (the looted BaseEntity, if any) and itemSource (the looted ItemContainer, if any). Because the hook fires on a network path rather than on a gameplay action, it can fire several times per second for one player while a panel is open. Returning a non-null value skips the update for that call. There is no narrower type to declare here: the parameter is always PlayerLoot, so you cannot filter by container type at dispatch time. Null-check playerLoot, baseEntity and any source before reading them. The original method returns void, so Oxide only inspects whether your return value is non-null.

Example plugin: Hide loot contents from players who cannot loot the container

LootUpdateGate.cs
using System.Linq;
using System;
using Newtonsoft.Json;
using Oxide.Core;
using UnityEngine;

namespace Oxide.Plugins
{
    [Info("Loot Update Gate", "RustPluginGenerator", "1.0.0")]
    [Description("Suppresses loot panel updates for containers the player is not allowed to loot.")]
    public class LootUpdateGate : RustPlugin
    {
        private const string PermBypass = "lootupdategate.bypass";

        private PluginConfig config;

        private class PluginConfig
        {
            [JsonProperty("Only owner can loot player-owned containers")]
            public bool OwnerOnly { get; set; } = true;

            [JsonProperty("Allow team members to loot each other's containers")]
            public bool AllowTeam { 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(PermBypass, this);
        }

        private object OnLootNetworkUpdate(PlayerLoot playerLoot)
        {
            if (!config.OwnerOnly || playerLoot == null) return null;

            var player = playerLoot.baseEntity as BasePlayer;
            if (player == null) return null;

            if (permission.UserHasPermission(player.UserIDString, PermBypass)) return null;

            var container = playerLoot.entitySource as StorageContainer;
            if (container == null) return null;
            if (container.OwnerID == 0UL) return null;
            if (container.OwnerID == player.userID.Get()) return null;

            if (config.AllowTeam && player.currentTeam != 0UL)
            {
                var team = RelationshipManager.ServerInstance.FindTeam(player.currentTeam);
                if (team != null && team.members.Contains(container.OwnerID)) return null;
            }

            return true;
        }
    }
}

The plugin listens on OnLootNetworkUpdate and inspects the PlayerLoot passed in. It resolves the player from playerLoot.baseEntity and the target from playerLoot.entitySource. If the target is a StorageContainer or another entity owned by a different player and the looter is neither the owner nor an admin with the bypass permission, the hook returns true. That stops PlayerLoot.SendUpdate from building the update message for that call, so the loot contents are never pushed to the client. A short warning is queued through NextTick so it is not printed on every network refresh; the hook itself stays silent.

Common use cases

  • Owner-only container access

    Block the loot panel update for any container whose OwnerID does not belong to the looting player, unless the player has an admin bypass permission.

  • Team member filtering

    Compare the looter's currentTeam with the team of the player who owns the corpse or bag being looted and suppress the update for outsiders.

  • Event loot gating

    Only send loot updates for containers spawned during a custom event to players who have the event permission, keeping reward stashes invisible to everyone else.

Pitfalls

  • Fires very frequently

    SendUpdate runs on every loot refresh, not just on open. Never call Puts or PrintWarning inside the hook; cache decisions or defer messages to a timer.

  • Skipping the update does not stop looting

    Returning non-null only suppresses the network message. The player can still interact with the container on the server, so pair this with CanLootEntity or CanLootPlayer for a real restriction.

  • Sources can be null

    entitySource and itemSource are not guaranteed to be set depending on what is being looted. Always null-check before reading ownership or the item container.

Build a plugin with OnLootNetworkUpdate

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

Prompt: Owner-only container access using the OnLootNetworkUpdate 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 OnLootNetworkUpdate

Generate