From e8c709a4dd27482ea7747cbd837e62f18066a97b Mon Sep 17 00:00:00 2001 From: Grinch_ Date: Sun, 20 Feb 2022 00:32:25 +0600 Subject: [PATCH] [VC] Add don't fall off bike --- src/locale.cpp | 2 +- src/locale.h | 2 +- src/vehicle.cpp | 27 +++++++++++++++++++++++---- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/locale.cpp b/src/locale.cpp index 31b5ace..04d7d32 100644 --- a/src/locale.cpp +++ b/src/locale.cpp @@ -88,7 +88,7 @@ size_t Locale::GetCurrentLocaleIndex() return localeIndex; } -Locale::eReturnCodes Locale::SetLocale(int index) +Locale::eReturnCodes Locale::SetLocale(size_t index) { if(m_pJson) { diff --git a/src/locale.h b/src/locale.h index 36c9323..64b7e87 100644 --- a/src/locale.h +++ b/src/locale.h @@ -69,5 +69,5 @@ public: index is the index of the language in the GetLocaleList() list */ - static eReturnCodes SetLocale(int index); + static eReturnCodes SetLocale(size_t index); }; \ No newline at end of file diff --git a/src/vehicle.cpp b/src/vehicle.cpp index a9fa2eb..893369f 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -106,7 +106,6 @@ Vehicle::Vehicle() } #ifdef GTASA - pPlayer->m_nPedFlags.CantBeKnockedOffBike = m_bDontFallBike ? 1 : 2; if (m_UnlimitedNitro::m_bEnabled && BY_GAME(pVeh->m_nVehicleSubClass, pVeh->m_nVehicleClass, NULL) == VEHICLE_AUTOMOBILE) @@ -613,10 +612,30 @@ void Vehicle::ShowPage() // } #endif ImGui::NextColumn(); -#ifdef GTASA - Ui::CheckboxWithHint("Don't fall off bike", &m_bDontFallBike); -#endif #ifndef GTA3 + if (Ui::CheckboxWithHint("Don't fall off bike", &m_bDontFallBike)) + { + if (m_bDontFallBike) + { +#ifdef GTASA + pPlayer->m_nPedFlags.CantBeKnockedOffBike = 1; +#elif GTAVC + + patch::SetRaw(0x614C4E, (void*)"\x8B\x8D\x00\x00\x00\x00", 6); + patch::SetRaw(0x614CC5, (void*)"\x8B\x85\x00\x00\x00\x00", 6); +#endif + } + else + { +#ifdef GTASA + pPlayer->m_nPedFlags.CantBeKnockedOffBike = 2; +#elif GTAVC + + patch::SetRaw(0x614C4E, (void*)"\x8B\x8D\xA8\x01\x00\x00", 6); + patch::SetRaw(0x614CC5, (void*)"\x8B\x85\xAC\x01\x00\x00", 6); +#endif + } + } Ui::CheckboxAddress("Drive on water", BY_GAME(0x969152, 0xA10B81, NULL)); #endif #ifdef GTASA