Skip to content

Commit de26a9e

Browse files
authored
Fix #539 Changing player position when he/she has a jetpack will remove the jetpack and bug when skin is changed (#3511)
1 parent e225a37 commit de26a9e

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

Client/mods/deathmatch/logic/CClientPed.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,8 +610,14 @@ void CClientPed::Teleport(const CVector& vecPosition)
610610
SetFrozenWaitingForGroundToLoad(true);
611611
}
612612

613+
// Player has jetpack?
614+
bool hasJetpack = HasJetPack();
615+
613616
// Set the real position
614617
m_pPlayerPed->Teleport(vecPosition.fX, vecPosition.fY, vecPosition.fZ);
618+
619+
// Restore jetpack
620+
SetHasJetPack(hasJetpack);
615621
}
616622
}
617623
}

Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,6 +1310,11 @@ bool CStaticFunctionDefinitions::SetElementPosition(CElement* pElement, const CV
13101310
m_pPlayerManager->BroadcastOnlyJoined(CElementRPCPacket(pElement, SET_ELEMENT_POSITION, *BitStream.pBitStream));
13111311
}
13121312

1313+
// Restore jetpack
1314+
CPed* ped = IS_PED(pElement) ? static_cast<CPed*>(pElement) : nullptr;
1315+
if (ped && ped->HasJetPack())
1316+
m_pPlayerManager->BroadcastOnlyJoined(CElementRPCPacket(ped, GIVE_PED_JETPACK, *BitStream.pBitStream));
1317+
13131318
return true;
13141319
}
13151320

0 commit comments

Comments
 (0)