Skip to content

fix: GetHitGroup offset#970

Merged
roflmuffin merged 1 commit intoroflmuffin:mainfrom
wiruwiru:main
Aug 4, 2025
Merged

fix: GetHitGroup offset#970
roflmuffin merged 1 commit intoroflmuffin:mainfrom
wiruwiru:main

Conversation

@wiruwiru
Copy link
Contributor

@wiruwiru wiruwiru commented Aug 4, 2025

No description provided.

@wiruwiru wiruwiru requested a review from roflmuffin as a code owner August 4, 2025 17:16
@roflmuffin
Copy link
Owner

Is this necessary now that hit group is on schema for takedamageinfo?

@wiruwiru
Copy link
Contributor Author

wiruwiru commented Aug 4, 2025

Is this necessary now that hit group is on schema for takedamageinfo?

This solves problems with OnTakeDamage.

Example:
04:22:41 [EROR] (cssharp:Core) Error invoking callback System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at System.Runtime.InteropServices.Marshal.ReadInt64(IntPtr ptr, Int32 ofs) at CounterStrikeSharp.API.Core.CTakeDamageInfo.GetHitGroup() in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/Model/CTakeDamageInfo.cs:line 23 at Deathmatch.Deathmatch.OnTakeDamage(DynamicHook hook) in C:\Users\Mates-PC\Desktop\SourceFactory\Projects\CSharp\Deathmatch\Deathmatch\Events.cs:line 355 at InvokeStub_Func2.Invoke(Object, Span1) at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) --- End of inner exception stack trace --- at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Delegate.DynamicInvokeImpl(Object[] args) at CounterStrikeSharp.API.Core.FunctionReference.<CreateWrappedCallback>b__18_0(fxScriptContext* context) in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/FunctionReference.cs:line 101

@roflmuffin
Copy link
Owner

What I mean to say is that this was added to schema so should be accessible from

public ref HitGroup_t HitGroupId => ref Schema.GetRef<HitGroup_t>(this.Handle, "CTakeDamageInfo", "m_iHitGroupId");
. I'll merge the PR anyway.

@roflmuffin roflmuffin enabled auto-merge (squash) August 4, 2025 23:34
@roflmuffin roflmuffin merged commit fedfe75 into roflmuffin:main Aug 4, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants