diff --git a/Client/mods/deathmatch/logic/CNetAPI.cpp b/Client/mods/deathmatch/logic/CNetAPI.cpp index f9780de177..23aa3abcf9 100644 --- a/Client/mods/deathmatch/logic/CNetAPI.cpp +++ b/Client/mods/deathmatch/logic/CNetAPI.cpp @@ -1687,6 +1687,34 @@ 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 a52aaaf841..2beb4dd92a 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()) + { + 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 096f60b57f..6f1cbdca3d 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()) { - 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