Skip to content

OnInventoryAmmoItemFind

Usage

  • Return a non-null value to override default behavior

Example Autogenerated

csharp
private void OnInventoryAmmoItemFind( PlayerInventory inventory, ItemDefinition fuelType )
{
    Puts( "OnInventoryAmmoItemFind works!" );
}

Location

  • Chainsaw::GetAmmo()
  • FlameThrower::GetAmmo()
csharp
//---
	BasePlayer ownerPlayer = base.GetOwnerPlayer();
	if (!ownerPlayer)
	{
		return null;
	}
	object returnvar = Interface.CallHook("OnInventoryAmmoItemFind", ownerPlayer.inventory, this.fuelType);
	if (returnvar is Item)
	{
		return (Item)returnvar;
	}
	return ownerPlayer.inventory.FindItemByItemName(this.fuelType.shortname);
//---
csharp
//---
	BasePlayer ownerPlayer = base.GetOwnerPlayer();
	if (!ownerPlayer)
	{
		return null;
	}
	object returnvar = Interface.CallHook("OnInventoryAmmoItemFind", ownerPlayer.inventory, this.fuelType);
	if (returnvar is Item)
	{
		return (Item)returnvar;
	}
	return ownerPlayer.inventory.FindItemByItemName(this.fuelType.shortname);
//---

Released under the MIT License.