Skip to content

Commit 180fbc0

Browse files
authored
Fix #3659 weapon switching (scroll and Q+E) while using Jetpack (#3573)
1 parent bea4823 commit 180fbc0

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

Client/multiplayer_sa/CMultiplayerSA.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,6 +1568,9 @@ void CMultiplayerSA::InitHooks()
15681568
MemSet((void*)0x7225F5, 0x90, 4);
15691569
MemCpy((void*)0x725DDE, "\xFF\x76\xB\x90\x90", 5);
15701570

1571+
// Allow switch weapon during jetpack task (#3569)
1572+
MemSetFast((void*)0x60D86F, 0x90, 19);
1573+
15711574
InitHooks_CrashFixHacks();
15721575

15731576
// Init our 1.3 hooks.

Server/mods/deathmatch/logic/CPed.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,3 +534,25 @@ void CPed::SetJackingVehicle(CVehicle* pVehicle)
534534
if (m_pJackingVehicle)
535535
m_pJackingVehicle->SetJackingPed(this);
536536
}
537+
538+
void CPed::SetHasJetPack(bool bHasJetPack)
539+
{
540+
if (m_bHasJetPack == bHasJetPack)
541+
return;
542+
543+
m_bHasJetPack = bHasJetPack;
544+
545+
if (!bHasJetPack)
546+
return;
547+
548+
// Set weapon slot to 0 if weapon is disabled with jetpack to avoid HUD and audio bugs
549+
eWeaponType weaponType = static_cast<eWeaponType>(GetWeaponType(GetWeaponSlot()));
550+
if (weaponType <= WEAPONTYPE_UNARMED)
551+
return;
552+
553+
bool weaponEnabled;
554+
CStaticFunctionDefinitions::GetJetpackWeaponEnabled(weaponType, weaponEnabled);
555+
556+
if (!weaponEnabled)
557+
CStaticFunctionDefinitions::SetPedWeaponSlot(this, 0);
558+
}

Server/mods/deathmatch/logic/CPed.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ class CPed : public CElement
188188
static const char* GetBodyPartName(unsigned char ucID);
189189

190190
bool HasJetPack() { return m_bHasJetPack; }
191-
void SetHasJetPack(bool bHasJetPack) { m_bHasJetPack = bHasJetPack; }
191+
void SetHasJetPack(bool bHasJetPack);
192192

193193
bool IsInWater() { return m_bInWater; }
194194
void SetInWater(bool bInWater) { m_bInWater = bInWater; }

0 commit comments

Comments
 (0)