RustTip

OnClothingItemChanged

OxideCarbonPlayer

Called when a clothing item is changed.

void OnClothingItemChanged(PlayerInventory playerInventory, Item item, bool bAdded)
Works — the game method in this build is the one the hook was written for.

Parameters

playerInventory
PlayerInventory
item
Item
bAdded
bool

Return value

voidThe return value is ignored — the hook only notifies.

Example

private void OnClothingItemChanged(PlayerInventory playerInventory, Item item, bool bAdded)
{
    Puts("OnClothingItemChanged");
}

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

Injection point

Rust.opj (Oxide)
void PlayerInventory.OnClothingChanged(Item, bool, BasePlayer)

Passes: PlayerInventory playerInventory, Item item, bool bAdded

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

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

// …
		if (_updatedVisibleHolsteredItemsCallback == null)
		{
			_updatedVisibleHolsteredItemsCallback = UpdatedVisibleHolsteredItems;
		}
		Invoke(_updatedVisibleHolsteredItemsCallback, 0.1f);
		item?.contents?.onItemAddedRemoved?.Invoke(item, bAdded, sourcePlayer);
	}
	baseEntity.ProcessMissionEvent(BaseMission.MissionEventType.CLOTHINGCHANGED, 0, 0f);
Interface.CallHook("OnClothingItemChanged", this, item, bAdded);
}

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.