Skip to content

Commit

Permalink
Make CNetAPI::WriteVehiclePuresync() use parent model ID when syncing…
Browse files Browse the repository at this point in the history
… vehicles added with engineRequestModel()
  • Loading branch information
BCG2000 committed Oct 28, 2021
1 parent ee88dd4 commit 51d3288
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Client/mods/deathmatch/logic/CNetAPI.cpp
Expand Up @@ -1547,9 +1547,15 @@ void CNetAPI::WriteVehiclePuresync(CClientPed* pPlayerModel, CClientVehicle* pVe
pPlayerModel->GetControllerState(ControllerState);
WriteFullKeysync(ControllerState, BitStream);

// Use parent model ID for non-standard vehicle model IDs.
// This avoids a mismatch between client and server, ensuring doors and damage sync correctly.
int iModelID = pVehicle->GetModel();
if (iModelID < 400 || iModelID > 611)
iModelID = pVehicle->GetModelInfo()->GetParentID();

// Write the clientside model
if (BitStream.Version() >= 0x05F)
BitStream.Write((int)pVehicle->GetModel());
BitStream.Write(iModelID);

// Grab the vehicle position
CVector vecPosition;
Expand Down

3 comments on commit 51d3288

@Brian9221
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this solve also #1898 for custom allocated model IDs?

@BCG2000
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Brian9221, no, that's a different issue. This commit fixes the broken door and damage sync for custom vehicles.

@Fernando-A-Rocha
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm commenting here because #2571 is still an issue. I'm not sure what happened but custom model vehicle door & panel damage is still not good.
@BCG2000

Please sign in to comment.