Skip to content

OnPlayerAttack

Usage

  • Return a non-null value to override default behavior

Example Autogenerated

csharp
private void OnPlayerAttack( BaseMelee instance, HitInfo info )
{
    Puts( "OnPlayerAttack works!" );
}
csharp
private void OnPlayerAttack( BasePlayer instance, HitInfo hitInfo )
{
    Puts( "OnPlayerAttack works!" );
}

Location

  • BaseMelee::DoAttackShared(HitInfo info)
  • BasePlayer::OnProjectileAttack(BaseEntity/RPCMessage msg)
csharp
public virtual void DoAttackShared(HitInfo info)
{
	if (Interface.CallHook("OnPlayerAttack", this, info) != null)
	{
		return;
	}
	this.GetAttackStats(info);
	if (info.HitEntity != null)
//---
csharp
//---
	}
	if (flag6)
	{
		this.stats.Add(firedProjectile.itemMod.category + "_hit_" + hitEntity.Categorize(), 1, Stats.Steam);
	}
	if (Interface.CallHook("OnPlayerAttack", this, hitInfo) != null)
	{
		return;
	}
	if (firedProjectile.integrity <= 0f)
	{
//---

Released under the MIT License.