From 38470a88e1a6500652962139baae707f59a85483 Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Sat, 2 Nov 2024 22:50:38 +0800 Subject: [PATCH] [saco] Implement/match `CPlayerPed::IsFalling()` --- saco/game/common.h | 7 ++++++- saco/game/playerped.cpp | 11 +++++++++++ saco/game/playerped.h | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/saco/game/common.h b/saco/game/common.h index f36ef8a..0830fa9 100644 --- a/saco/game/common.h +++ b/saco/game/common.h @@ -74,7 +74,12 @@ typedef struct _WEAPON_SLOT_TYPE #pragma pack(1) typedef struct _PED_TASKS_TYPE { - char _gap0[16]; + char _gap0[4]; + + // Basic Tasks + DWORD * pdwDamage; + + char _gap8[8]; DWORD * pdwJumpJetPack; diff --git a/saco/game/playerped.cpp b/saco/game/playerped.cpp index dfb2f84..a32fa30 100644 --- a/saco/game/playerped.cpp +++ b/saco/game/playerped.cpp @@ -979,6 +979,17 @@ BOOL CPlayerPed::IsFighting() //----------------------------------------------------------- +BOOL CPlayerPed::IsFalling() +{ + if(m_pPed && !IN_VEHICLE(m_pPed) && m_pPed->Tasks->pdwDamage) + { + return GetTaskTypeFromTask(m_pPed->Tasks->pdwDamage) == 208; + } + return FALSE; +} + +//----------------------------------------------------------- + void CPlayerPed::StartJetpack() { if(!m_pPed) return; diff --git a/saco/game/playerped.h b/saco/game/playerped.h index e3c9e8a..0c24b86 100644 --- a/saco/game/playerped.h +++ b/saco/game/playerped.h @@ -110,6 +110,7 @@ public: BOOL IsJumping(); BOOL IsFighting(); + BOOL IsFalling(); float GetAimZ(); void SetAimZ(float fAimZ);