From 8762250ea71ddcafe9c03e06ec0eae1cae99a9b2 Mon Sep 17 00:00:00 2001 From: ricardoofnl Date: Sun, 30 Aug 2026 13:27:26 +0700 Subject: [PATCH] [saco] Implement/match `PedDamage_Hook` --- saco/game/hooks.cpp | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/saco/game/hooks.cpp b/saco/game/hooks.cpp index a40ad86..e4bfb33 100644 --- a/saco/game/hooks.cpp +++ b/saco/game/hooks.cpp @@ -773,7 +773,43 @@ NUDE CGameShutdownHook() //----------------------------------------------------------- -NUDE PedDamage_Hook() {} +DWORD unnamed_101516A0; // CEventDamage * +DWORD unnamed_101516A4; // CPed * taking the damage + +int __stdcall FUNC_100A3BB0(DWORD *pEventDamage, PED_TYPE *pPed); // todo: implement `FUNC_100A3BB0` + +NUDE PedDamage_Hook() +{ + __asm + { + mov eax, fs:0 + test ecx, ecx + jz computeResponse + mov unnamed_101516A0, ecx + mov ebx, [esp+4] + test ebx, ebx + jz computeResponse + mov unnamed_101516A4, ebx + pushad + + mov eax, unnamed_101516A4 + push eax + mov ecx, unnamed_101516A0 + push ecx + call FUNC_100A3BB0 + test eax, eax + jz computeResponseAfterSync + + // the netcode dealt with it, don't let the game apply the damage + popad + retn 0Ch + computeResponseAfterSync: + popad + computeResponse: + mov edx, 0x4B5AC6 ;// CEventDamage::ComputeDamageResponse + 6 + jmp edx + } +} //-----------------------------------------------------------