Skip to content

OnAmmoSwitch

Usage

  • Return a non-null value to override default behavior

Example Autogenerated

csharp
private void OnAmmoSwitch( BaseProjectile instance, BasePlayer ownerPlayer, ItemDefinition itemDefinition )
{
    Puts( "OnAmmoSwitch works!" );
}

Location

  • BaseProjectile::SwitchAmmoTo(BaseEntity/RPCMessage msg)
csharp
//---
	ItemModProjectile component = itemDefinition.GetComponent<ItemModProjectile>();
	if (!component || !component.IsAmmo(this.primaryMagazine.definition.ammoTypes))
	{
		return;
	}
	if (Interface.CallHook("OnAmmoSwitch", this, ownerPlayer, itemDefinition) != null)
	{
		return;
	}
	if (this.primaryMagazine.contents > 0)
	{
//---

Released under the MIT License.