From 014b86266bad472e26ee3d78c9300809c8122810 Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Tue, 29 Oct 2024 11:47:52 +0800 Subject: [PATCH] [saco] Implement/match `CPlayerPed::ProcessVehicleHorn()` --- saco/game/playerped.cpp | 28 ++++++++++++++++++++++++++++ saco/game/playerped.h | 2 ++ 2 files changed, 30 insertions(+) diff --git a/saco/game/playerped.cpp b/saco/game/playerped.cpp index 30baeb9..584bf03 100644 --- a/saco/game/playerped.cpp +++ b/saco/game/playerped.cpp @@ -1006,6 +1006,34 @@ VEHICLE_TYPE* CPlayerPed::GetGtaContactVehicle() //----------------------------------------------------------- +void CPlayerPed::ProcessVehicleHorn() +{ + if(!m_pPed) return; + if(!GamePool_Ped_GetAt(m_dwGTAId)) return; + + GTA_CONTROLSET *pPlayerControls; + + if(!m_bytePlayerNumber) { + pPlayerControls = GameGetInternalKeys(); + } else { + pPlayerControls = GameGetPlayerKeys(m_bytePlayerNumber); + } + + VEHICLE_TYPE *pGtaVehicle = (VEHICLE_TYPE *)m_pPed->pVehicle; + + if(pGtaVehicle) { + if(IN_VEHICLE(m_pPed) && (pGtaVehicle->pDriver == m_pPed)) { + if(pPlayerControls->wKeys1[18]) { + pGtaVehicle->byteHorn2 = 1; + } else { + pGtaVehicle->byteHorn2 = 0; + } + } + } +} + +//----------------------------------------------------------- + PCHAR CPlayerPed::GetLoadedShopName() { if(!m_pPed) return NULL; diff --git a/saco/game/playerped.h b/saco/game/playerped.h index 0e6d0b9..0b0cfb6 100644 --- a/saco/game/playerped.h +++ b/saco/game/playerped.h @@ -92,6 +92,8 @@ public: CPlayerPed(); + void ProcessVehicleHorn(); + void HandsUp(); float GetAimZ();