Oxygen

OnPlayerTakeItemInHands

This hook is triggered when a player attempts to take an item into their hands. Returning false will prevent the action.

Definition

public override bool OnPlayerTakeItemInHands(PlayerBase player, string itemName)
{
    return true;
}

Parameters

ParameterTypeDescription
playerPlayerBaseThe instance of the player attempting to hold the item.
itemNamestringThe name or type of the item being taken into hands.

Return Value

TypeDescription
boolReturn true to allow the action, or false to cancel it.

Usage Example

public override bool OnPlayerTakeItemInHands(PlayerBase player, string itemName)
{
    if (itemName == "Restricted_Item")
    {
        return false;
    }
    return true;
}

On this page