From 4ec4ca233d7db4cf26f938d6c54ffe61951bb4cb Mon Sep 17 00:00:00 2001 From: NanoBob Date: Mon, 20 Apr 2026 23:16:15 +0200 Subject: [PATCH 1/3] Reintroduce sending of damager info, without bitstream version checks --- Client/mods/deathmatch/logic/CNetAPI.cpp | 29 +++++++++++++++++++ .../logic/net/CSimVehiclePuresyncPacket.cpp | 15 ++++++++++ .../logic/packets/CVehiclePuresyncPacket.cpp | 26 +++++++---------- 3 files changed, 55 insertions(+), 15 deletions(-) diff --git a/Client/mods/deathmatch/logic/CNetAPI.cpp b/Client/mods/deathmatch/logic/CNetAPI.cpp index f9780de1778..91ea34f5ae5 100644 --- a/Client/mods/deathmatch/logic/CNetAPI.cpp +++ b/Client/mods/deathmatch/logic/CNetAPI.cpp @@ -1687,6 +1687,35 @@ void CNetAPI::WriteVehiclePuresync(CClientPed* pPlayerModel, CClientVehicle* pVe BitStream.WriteBit(false); } + + if (!g_pClientGame->GetDamageSent()) + { + g_pClientGame->SetDamageSent(true); + + ElementID DamagerID = g_pClientGame->GetDamagerID(); + if (DamagerID != RESERVED_ELEMENT_ID) + { + BitStream.WriteBit(true); + BitStream.Write(DamagerID); + + SWeaponTypeSync weaponType; + weaponType.data.ucWeaponType = g_pClientGame->GetDamageWeapon(); + BitStream.Write(&weaponType); + + SBodypartSync bodypart; + bodypart.data.uiBodypart = g_pClientGame->GetDamageBodyPiece(); + BitStream.Write(&bodypart); + } + else + { + BitStream.WriteBit(false); + } + } + else + { + BitStream.WriteBit(false); + } + // Player health sync (scaled from 0.0f-200.0f to 0-255 to save three bytes). // Scale goes up to 200.0f because having max stats gives you the double of health. SPlayerHealthSync health; diff --git a/Server/mods/deathmatch/logic/net/CSimVehiclePuresyncPacket.cpp b/Server/mods/deathmatch/logic/net/CSimVehiclePuresyncPacket.cpp index a52aaaf841a..25b2d87bb15 100644 --- a/Server/mods/deathmatch/logic/net/CSimVehiclePuresyncPacket.cpp +++ b/Server/mods/deathmatch/logic/net/CSimVehiclePuresyncPacket.cpp @@ -163,6 +163,21 @@ bool CSimVehiclePuresyncPacket::Read(NetBitStreamInterface& BitStream) } } + if (BitStream.ReadBit() == true) + { + ElementID DamagerID; + if (!BitStream.Read(DamagerID)) + return false; + + SWeaponTypeSync weaponType; + if (!BitStream.Read(&weaponType)) + return false; + + SBodypartSync bodyPart; + if (!BitStream.Read(&bodyPart)) + return false; + } + // Player health SPlayerHealthSync health; if (!BitStream.Read(&health)) diff --git a/Server/mods/deathmatch/logic/packets/CVehiclePuresyncPacket.cpp b/Server/mods/deathmatch/logic/packets/CVehiclePuresyncPacket.cpp index 096f60b57f6..b2f9315a0cb 100644 --- a/Server/mods/deathmatch/logic/packets/CVehiclePuresyncPacket.cpp +++ b/Server/mods/deathmatch/logic/packets/CVehiclePuresyncPacket.cpp @@ -275,25 +275,21 @@ bool CVehiclePuresyncPacket::Read(NetBitStreamInterface& BitStream) } } - // Update Damage info - if (BitStream.Version() >= 0x047) + if (BitStream.ReadBit() == true) { - if (BitStream.ReadBit() == true) - { - ElementID DamagerID; - if (!BitStream.Read(DamagerID)) - return false; + ElementID DamagerID; + if (!BitStream.Read(DamagerID)) + return false; - SWeaponTypeSync weaponType; - if (!BitStream.Read(&weaponType)) - return false; + SWeaponTypeSync weaponType; + if (!BitStream.Read(&weaponType)) + return false; - SBodypartSync bodyPart; - if (!BitStream.Read(&bodyPart)) - return false; + SBodypartSync bodyPart; + if (!BitStream.Read(&bodyPart)) + return false; - pSourcePlayer->SetDamageInfo(DamagerID, weaponType.data.ucWeaponType, static_cast(bodyPart.data.uiBodypart)); - } + pSourcePlayer->SetDamageInfo(DamagerID, weaponType.data.ucWeaponType, static_cast(bodyPart.data.uiBodypart)); } // Player health From 62a5ad68da587c5c42208c2cbef09a0ec9789e5a Mon Sep 17 00:00:00 2001 From: NanoBob Date: Mon, 20 Apr 2026 23:19:02 +0200 Subject: [PATCH 2/3] Formatting --- Client/mods/deathmatch/logic/CNetAPI.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Client/mods/deathmatch/logic/CNetAPI.cpp b/Client/mods/deathmatch/logic/CNetAPI.cpp index 91ea34f5ae5..23aa3abcf92 100644 --- a/Client/mods/deathmatch/logic/CNetAPI.cpp +++ b/Client/mods/deathmatch/logic/CNetAPI.cpp @@ -1687,7 +1687,6 @@ void CNetAPI::WriteVehiclePuresync(CClientPed* pPlayerModel, CClientVehicle* pVe BitStream.WriteBit(false); } - if (!g_pClientGame->GetDamageSent()) { g_pClientGame->SetDamageSent(true); From aca40d7a9072bb04816d74f80bb041d413725eff Mon Sep 17 00:00:00 2001 From: NanoBob Date: Mon, 20 Apr 2026 23:45:13 +0200 Subject: [PATCH 3/3] Removed unnecessary == true --- Server/mods/deathmatch/logic/net/CSimVehiclePuresyncPacket.cpp | 2 +- Server/mods/deathmatch/logic/packets/CVehiclePuresyncPacket.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Server/mods/deathmatch/logic/net/CSimVehiclePuresyncPacket.cpp b/Server/mods/deathmatch/logic/net/CSimVehiclePuresyncPacket.cpp index 25b2d87bb15..2beb4dd92a8 100644 --- a/Server/mods/deathmatch/logic/net/CSimVehiclePuresyncPacket.cpp +++ b/Server/mods/deathmatch/logic/net/CSimVehiclePuresyncPacket.cpp @@ -163,7 +163,7 @@ bool CSimVehiclePuresyncPacket::Read(NetBitStreamInterface& BitStream) } } - if (BitStream.ReadBit() == true) + if (BitStream.ReadBit()) { ElementID DamagerID; if (!BitStream.Read(DamagerID)) diff --git a/Server/mods/deathmatch/logic/packets/CVehiclePuresyncPacket.cpp b/Server/mods/deathmatch/logic/packets/CVehiclePuresyncPacket.cpp index b2f9315a0cb..6f1cbdca3df 100644 --- a/Server/mods/deathmatch/logic/packets/CVehiclePuresyncPacket.cpp +++ b/Server/mods/deathmatch/logic/packets/CVehiclePuresyncPacket.cpp @@ -275,7 +275,7 @@ bool CVehiclePuresyncPacket::Read(NetBitStreamInterface& BitStream) } } - if (BitStream.ReadBit() == true) + if (BitStream.ReadBit()) { ElementID DamagerID; if (!BitStream.Read(DamagerID))