From c478c7dbfee764e79c1f541c6b2c9eada9cc7b34 Mon Sep 17 00:00:00 2001 From: ricardoofnl Date: Thu, 3 Sep 2026 02:21:01 +0700 Subject: [PATCH] [saco] Match `FUNC_100A5240`; the team-damage test compares two bytes, not two ints --- saco/game/hooks.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/saco/game/hooks.cpp b/saco/game/hooks.cpp index 33228ab..7006422 100644 --- a/saco/game/hooks.cpp +++ b/saco/game/hooks.cpp @@ -2830,6 +2830,39 @@ DWORD dwDamageWeapon = 0; BOOL bIgnoreVehicleDamage = 0; DWORD dwInflictDamageRetAddr = 0; +PLAYERID wInflictDamageDriver; +CPlayerPool *pInflictDamagePool; + +// true when the local player drives dwVehicle and dwPed belongs to a team mate +BOOL FUNC_100A5240(DWORD dwVehicle, DWORD dwPed) +{ + if(!pNetGame || !pGame || !pGame->FindPlayerPed() + || !pGame->FindPlayerPed()->IsInVehicle() + || pGame->FindPlayerPed()->sub_100ABFC0() + || pGame->FindPlayerPed()->FUNC_100AC000() != (int)dwVehicle) + return FALSE; + + wInflictDamageDriver = FUNC_100A3AE0(dwPed); + if(wInflictDamageDriver == 0xFFFF) return FALSE; + + pInflictDamagePool = pNetGame->GetPlayerPool(); + if(!pInflictDamagePool) return FALSE; + + if(pNetGame->GetSettings()->field_22) + { + BYTE byteTeam = pInflictDamagePool->m_pLocalPlayer->m_byteTeam; + + if(byteTeam == 0xFF) return FALSE; + + if((BYTE)pNetGame->GetPlayerPool()->GetAt(wInflictDamageDriver)->field_109 == byteTeam) + return TRUE; + } + + return FALSE; +} + +//----------------------------------------------------------- + NUDE CVehicle__InflictDamage_Hook() { _asm mov dwDamagedVehicle, ecx