Skip to content

Fix vehicle door and panel damage states resetting on custom model change (#2571) - #5231

Open
MohabCodeX wants to merge 1 commit into
multitheftauto:masterfrom
MohabCodeX:fix/issue-2571-custom-model-damage
Open

Fix vehicle door and panel damage states resetting on custom model change (#2571)#5231
MohabCodeX wants to merge 1 commit into
multitheftauto:masterfrom
MohabCodeX:fix/issue-2571-custom-model-damage

Conversation

@MohabCodeX

Copy link
Copy Markdown
Contributor

Fixes #2571

Fixed vehicle door, panel, and wheel damage states resetting to intact when changing to a custom model ID via setElementModel.

Testing Steps

  1. Start runcode:

    start runcode
    
  2. Allocate a custom vehicle model on the client:

    crun customId = engineRequestModel("vehicle", 411)
  3. Spawn a damaged vehicle on the server and put the player in it:

    srun p = getRandomPlayer(); veh = createVehicle(411, getElementPosition(p)); warpPedIntoVehicle(p, veh); setVehicleDoorState(veh, 0, 2)
  4. Switch to the custom model on the client:

    crun veh = getPedOccupiedVehicle(localPlayer); setElementModel(veh, customId)
  5. Verify that the door damage remains preserved (2) instead of resetting to intact (0):

    crun outputChatBox("Door 0 state: " .. tostring(getVehicleDoorState(veh, 0)))

@Fernando-A-Rocha

Copy link
Copy Markdown
Contributor

🤩

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Door & panel states (damage) not syncing for vehicles with custom model IDs

2 participants