Skip to content

OnMeleeAttack

Usage

  • Return a non-null value to override default behavior

Example Autogenerated

csharp
private void OnMeleeAttack( BasePlayer player, HitInfo hitInfo )
{
    Puts( "OnMeleeAttack works!" );
}

Location

  • BaseMelee::PlayerAttack(BaseEntity/RPCMessage msg)
csharp
//---
				hitInfo.Initiator = player;
				hitInfo.Weapon = this;
				hitInfo.WeaponPrefab = this;
				hitInfo.Predicted = msg.connection;
				hitInfo.damageProperties = this.damageProperties;
				if (Interface.CallHook("OnMeleeAttack", player, hitInfo) != null)
				{
					return;
				}
				if (hitInfo.IsNaNOrInfinity())
				{
//---

Released under the MIT License.