diff --git a/Client/multiplayer_sa/CMultiplayerSA.cpp b/Client/multiplayer_sa/CMultiplayerSA.cpp index 70ec1b09e2..4dedff60c5 100644 --- a/Client/multiplayer_sa/CMultiplayerSA.cpp +++ b/Client/multiplayer_sa/CMultiplayerSA.cpp @@ -1568,6 +1568,9 @@ void CMultiplayerSA::InitHooks() MemSet((void*)0x7225F5, 0x90, 4); MemCpy((void*)0x725DDE, "\xFF\x76\xB\x90\x90", 5); + // Allow switch weapon during jetpack task (#3569) + MemSetFast((void*)0x60D86F, 0x90, 19); + InitHooks_CrashFixHacks(); // Init our 1.3 hooks. diff --git a/Server/mods/deathmatch/logic/CPed.cpp b/Server/mods/deathmatch/logic/CPed.cpp index e3b7e0128c..ba50c25caa 100644 --- a/Server/mods/deathmatch/logic/CPed.cpp +++ b/Server/mods/deathmatch/logic/CPed.cpp @@ -534,3 +534,25 @@ void CPed::SetJackingVehicle(CVehicle* pVehicle) if (m_pJackingVehicle) m_pJackingVehicle->SetJackingPed(this); } + +void CPed::SetHasJetPack(bool bHasJetPack) +{ + if (m_bHasJetPack == bHasJetPack) + return; + + m_bHasJetPack = bHasJetPack; + + if (!bHasJetPack) + return; + + // Set weapon slot to 0 if weapon is disabled with jetpack to avoid HUD and audio bugs + eWeaponType weaponType = static_cast(GetWeaponType(GetWeaponSlot())); + if (weaponType <= WEAPONTYPE_UNARMED) + return; + + bool weaponEnabled; + CStaticFunctionDefinitions::GetJetpackWeaponEnabled(weaponType, weaponEnabled); + + if (!weaponEnabled) + CStaticFunctionDefinitions::SetPedWeaponSlot(this, 0); +} diff --git a/Server/mods/deathmatch/logic/CPed.h b/Server/mods/deathmatch/logic/CPed.h index 47e70e7189..be3e590096 100644 --- a/Server/mods/deathmatch/logic/CPed.h +++ b/Server/mods/deathmatch/logic/CPed.h @@ -188,7 +188,7 @@ class CPed : public CElement static const char* GetBodyPartName(unsigned char ucID); bool HasJetPack() { return m_bHasJetPack; } - void SetHasJetPack(bool bHasJetPack) { m_bHasJetPack = bHasJetPack; } + void SetHasJetPack(bool bHasJetPack); bool IsInWater() { return m_bInWater; } void SetInWater(bool bInWater) { m_bInWater = bInWater; }