From a6eee0bd1c3308a94cfb6efce8508fd486137691 Mon Sep 17 00:00:00 2001 From: FileEX Date: Tue, 25 Jun 2024 13:38:57 +0200 Subject: [PATCH 1/4] Fix old bug --- Client/mods/deathmatch/logic/CClientPed.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Client/mods/deathmatch/logic/CClientPed.cpp b/Client/mods/deathmatch/logic/CClientPed.cpp index 735c1115c8..47f87ab003 100644 --- a/Client/mods/deathmatch/logic/CClientPed.cpp +++ b/Client/mods/deathmatch/logic/CClientPed.cpp @@ -607,8 +607,14 @@ void CClientPed::Teleport(const CVector& vecPosition) SetFrozenWaitingForGroundToLoad(true); } + // Player has jetpack? + bool hasJetpack = HasJetPack(); + // Set the real position m_pPlayerPed->Teleport(vecPosition.fX, vecPosition.fY, vecPosition.fZ); + + // Restore jetpack + SetHasJetPack(hasJetpack); } } } From 9ce5b142ac56be05cef23ebf021a53a933396d5c Mon Sep 17 00:00:00 2001 From: FileEX Date: Tue, 16 Jul 2024 13:43:49 +0200 Subject: [PATCH 2/4] Fix desync --- .../mods/deathmatch/logic/CStaticFunctionDefinitions.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp b/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp index 58cdfbce4a..e44ea15ee2 100644 --- a/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp +++ b/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp @@ -1259,6 +1259,11 @@ bool CStaticFunctionDefinitions::SetElementPosition(CElement* pElement, const CV m_pColManager->DoHitDetection(pElement->GetPosition(), pElement); } + // Has jetpack? + CPed* ped; + if (IS_PLAYER(pElement) || IS_PED(pElement)) + ped = static_cast(pElement); + // Construct the set position packet CBitStream BitStream; BitStream.pBitStream->Write(vecPosition.fX); @@ -1280,6 +1285,10 @@ bool CStaticFunctionDefinitions::SetElementPosition(CElement* pElement, const CV m_pPlayerManager->BroadcastOnlyJoined(CElementRPCPacket(pElement, SET_ELEMENT_POSITION, *BitStream.pBitStream)); } + // Restore jetpack + if (ped && ped->HasJetPack()) + m_pPlayerManager->BroadcastOnlyJoined(CElementRPCPacket(ped, GIVE_PED_JETPACK, *BitStream.pBitStream)); + return true; } From 782960ddd321d57a3d6afffdbe9f0f372a10cd2e Mon Sep 17 00:00:00 2001 From: FileEX Date: Tue, 16 Jul 2024 13:51:51 +0200 Subject: [PATCH 3/4] Update CStaticFunctionDefinitions.cpp --- Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp b/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp index e44ea15ee2..605b26294a 100644 --- a/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp +++ b/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp @@ -1259,10 +1259,7 @@ bool CStaticFunctionDefinitions::SetElementPosition(CElement* pElement, const CV m_pColManager->DoHitDetection(pElement->GetPosition(), pElement); } - // Has jetpack? - CPed* ped; - if (IS_PLAYER(pElement) || IS_PED(pElement)) - ped = static_cast(pElement); + CPed* ped = (IS_PLAYER(pElement) || IS_PED(pElement)) ? static_cast(pElement) : nullptr; // Construct the set position packet CBitStream BitStream; From bc486609dd5a154a12a072a1be17db75f40f0327 Mon Sep 17 00:00:00 2001 From: FileEX Date: Tue, 16 Jul 2024 13:54:28 +0200 Subject: [PATCH 4/4] Update CStaticFunctionDefinitions.cpp --- Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp b/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp index 9ffdfca282..8b61a35a6b 100644 --- a/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp +++ b/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp @@ -1259,8 +1259,6 @@ bool CStaticFunctionDefinitions::SetElementPosition(CElement* pElement, const CV m_pColManager->DoHitDetection(pElement->GetPosition(), pElement); } - CPed* ped = (IS_PLAYER(pElement) || IS_PED(pElement)) ? static_cast(pElement) : nullptr; - // Construct the set position packet CBitStream BitStream; BitStream.pBitStream->Write(vecPosition.fX); @@ -1283,6 +1281,7 @@ bool CStaticFunctionDefinitions::SetElementPosition(CElement* pElement, const CV } // Restore jetpack + CPed* ped = IS_PED(pElement) ? static_cast(pElement) : nullptr; if (ped && ped->HasJetPack()) m_pPlayerManager->BroadcastOnlyJoined(CElementRPCPacket(ped, GIVE_PED_JETPACK, *BitStream.pBitStream));