[saco] Implement/match CActorPed::Destroy()

This commit is contained in:
RD42 2024-10-24 22:25:48 +08:00
parent 94bfbc8947
commit a4657baccf
2 changed files with 29 additions and 0 deletions

View File

@ -34,3 +34,28 @@ CActorPed::CActorPed(int iSkin, float fX, float fY,float fZ,float fRotation)
//----------------------------------------------------------- //-----------------------------------------------------------
void CActorPed::Destroy()
{
DWORD dwPedPtr = (DWORD)m_pPed;
// If it points to the CPlaceable vtable it's not valid
if(!m_pPed || !GamePool_Ped_GetAt(m_dwGTAId) || m_pPed->entity.vtable == 0x863C40)
{
m_pPed = NULL;
m_pEntity = NULL;
m_dwGTAId = 0;
return;
}
// DESTROY METHOD
_asm mov ecx, dwPedPtr
_asm mov ebx, [ecx] ; vtable
_asm push 1
_asm call [ebx] ; destroy
m_pPed = NULL;
m_pEntity = NULL;
}
//-----------------------------------------------------------

View File

@ -6,9 +6,13 @@
class CActorPed : public CEntity class CActorPed : public CEntity
{ {
public: public:
// Constructor/Destructor. // Constructor/Destructor.
CActorPed(int iSkin, float fPosX, float fPosY, float fPosZ, float fRotation = 0.0f); CActorPed(int iSkin, float fPosX, float fPosY, float fPosZ, float fRotation = 0.0f);
void Destroy();
PED_TYPE *m_pPed; PED_TYPE *m_pPed;
DWORD m_dwMarkerID; DWORD m_dwMarkerID;
DWORD m_dwArrow; DWORD m_dwArrow;