Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added hitgroup to CTakeDamageInfo #665

Merged
merged 9 commits into from
Nov 23, 2024
32 changes: 32 additions & 0 deletions managed/CounterStrikeSharp.API/Core/Model/CTakeDamageInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System.Runtime.InteropServices;

namespace CounterStrikeSharp.API.Core;

public partial class CTakeDamageInfo
{
/// <summary>
/// Retrieves the hitgroup
/// </summary>
/// <returns>
/// Returns a <see cref="HitGroup_t"/> enumeration representing the player's current hit group,
/// or <see cref="HitGroup_t.HITGROUP_INVALID"/> if the hit group cannot be determined.
/// </returns>
public HitGroup_t GetHitGroup()
{
IntPtr v4 = Marshal.ReadIntPtr(Handle, 0x78);

if (v4 == nint.Zero)
{
return HitGroup_t.HITGROUP_INVALID;
}

IntPtr v1 = Marshal.ReadIntPtr(v4, 16);

if (v1 == nint.Zero)
{
return HitGroup_t.HITGROUP_GENERIC;
}

return (HitGroup_t)Marshal.ReadInt32(v1, 56);
}
}
Loading