RustTip

OnLootPlayer

OxideCarbonPlayer

Called when loot player occurs.

void OnLootPlayer(BasePlayer basePlayer, BasePlayer local0)
Works — the game method in this build is the one the hook was written for.

Parameters

basePlayer
BasePlayer
local0
BasePlayer

Return value

voidThe return value is ignored — the hook only notifies.

Example

private void OnLootPlayer(BasePlayer basePlayer, BasePlayer local0)
{
    Puts("OnLootPlayer");
}

Works in both Oxide and Carbon: Carbon loads Oxide plugins as is.

Injection point

Rust.opj (Oxide)
void BasePlayer.RPC_LootPlayer(BaseEntity.RPCMessage)

Passes: BasePlayer basePlayer, BasePlayer local0

WorksReturnBehavior: ContinueArgumentBehavior: UseArgumentString (this, l0)Assembly-CSharp.dll

Where it is called (this branch's game code)

// …
public void RPC_LootPlayer(RPCMessage msg)
{
	BasePlayer player = msg.player;
	if ((bool)player && player.CanInteract() && CanBeLooted(player) && player.inventory.loot.StartLootingEntity(this))
	{
		player.inventory.loot.AddContainer(inventory.containerMain);
		player.inventory.loot.AddContainer(inventory.containerWear);
		player.inventory.loot.AddContainer(inventory.containerBelt);
		Interface.CallHook("OnLootPlayer", this, player);
		player.inventory.loot.SendImmediate();
		player.RadioactiveLootCheck(player.inventory.loot.containers);
		player.ClientRPC(RpcTarget.Player("RPC_OpenLootPanel", player), "player_corpse");
	}
}

Sources: Rust.opj from OxideMod/Oxide.Rust (MIT) and hook metadata of the Carbon documentation (MIT). Method code is decompiled from this branch's server.