From 9b91485a8a1df341173bb6b9e3cb7fc508dc9687 Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Thu, 31 Oct 2024 17:31:36 +0800 Subject: [PATCH] [saco] Implement/match `CRemotePlayer::EnterVehicle(...)` --- saco/net/remoteplayer.cpp | 19 ++++++++++++++++++- saco/net/remoteplayer.h | 4 +++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/saco/net/remoteplayer.cpp b/saco/net/remoteplayer.cpp index 77489b1..4e91c88 100644 --- a/saco/net/remoteplayer.cpp +++ b/saco/net/remoteplayer.cpp @@ -14,7 +14,7 @@ CRemotePlayer::CRemotePlayer() field_1E7 = 0; field_10A = 0; m_PlayerID = INVALID_PLAYER_ID; - field_1DD = 0; + m_pPlayerPed = NULL; field_1B8 = 0; field_109 = -1; field_4 = 1; @@ -83,3 +83,20 @@ DWORD CRemotePlayer::GetPlayerColorAsARGB() } //---------------------------------------------------- + +void CRemotePlayer::EnterVehicle(VEHICLEID VehicleID, BOOL bPassenger) +{ + CVehiclePool *pVehiclePool = pNetGame->GetVehiclePool(); + CVehicle *pVehicle = pVehiclePool->GetAt(VehicleID); + + if(m_pPlayerPed && pVehicle && !m_pPlayerPed->IsInVehicle()) { + int iGtaVehicleID = pVehiclePool->FindGtaIDFromID(VehicleID); + if(iGtaVehicleID && iGtaVehicleID != INVALID_VEHICLE_ID) { + m_pPlayerPed->SetKeys(0,0,0); + m_pPlayerPed->EnterVehicle(iGtaVehicleID,bPassenger); + } + } +} + +//---------------------------------------------------- + diff --git a/saco/net/remoteplayer.h b/saco/net/remoteplayer.h index ceb3f5f..9e9f9f8 100644 --- a/saco/net/remoteplayer.h +++ b/saco/net/remoteplayer.h @@ -41,7 +41,7 @@ private: char field_1C9[12]; DWORD field_1D5; DWORD field_1D9; - int field_1DD; + CPlayerPed *m_pPlayerPed; int field_1E1; PLAYERID m_PlayerID; short field_1E7; @@ -60,6 +60,8 @@ public: void SetPlayerColor(DWORD dwColor); DWORD GetPlayerColorAsRGBA(); DWORD GetPlayerColorAsARGB(); + + void EnterVehicle(VEHICLEID VehicleID, BOOL bPassenger); }; //----------------------------------------------------