From 4a743549b593d0bb2ab6e6345a2d9202e815bc21 Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Sun, 5 May 2024 18:29:24 +0800 Subject: [PATCH] [saco] Implement and match `CPlayerPed::ResetPointers()` --- saco/game/playerped.cpp | 10 ++++++++++ saco/game/playerped.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/saco/game/playerped.cpp b/saco/game/playerped.cpp index 462f80a..ad62988 100644 --- a/saco/game/playerped.cpp +++ b/saco/game/playerped.cpp @@ -50,6 +50,16 @@ CPlayerPed::CPlayerPed() field_2F9 = 0; } +//----------------------------------------------------------- +// If the game has internally destroyed the ped +// during this frame, the ped pointer should become 0 + +void CPlayerPed::ResetPointers() +{ + m_pPed = GamePool_Ped_GetAt(m_dwGTAId); + m_pEntity = (ENTITY_TYPE *)m_pPed; +} + void CPlayerPed::GiveWeapon(int iWeaponID, int iAmmo) { if(!m_pPed) return; diff --git a/saco/game/playerped.h b/saco/game/playerped.h index 7ccec85..c6836a3 100644 --- a/saco/game/playerped.h +++ b/saco/game/playerped.h @@ -16,6 +16,8 @@ class CPlayerPed : public CEntity { public: + void ResetPointers(); + WORD GetAmmo(); void GiveWeapon(int iWeaponID, int iAmmo);