Server
Operating system: Linux Ubuntu 18.04
Artifact version: 5687
Incident
Summary: If you set the body health with natives (SetVehicleBodyHealth client or sever-sided) it will sync to the clients, but won’t be syncing with the server’s GetVehicleBodyHealth native, but normal vehicle damage, still syncing the native. If damaging the vehicle purely, it will reduce the damage from the GET native (server-sided)
Example: if the vehicle had 1000HP and you set it to 800HP, it will sync just fine with the clients and will print 800HP if trying the get native (client-sided), but if trying on server-sided, 1000HP will be printed.
After getting somehow (by hitting something) 100 damage to the vehicle: the client will print 700HP (800HP that was set minus 100HP that was caused by the hit), as it should; but on the server-side, it will print 900HP (because the SET native wasn’t synced and the server just received the 100HP damaged caused by the hit)
Expected behavior: If the vehicle’s body health is set, the value should sync to the server-sided native GetVehicleBodyHealth.
Actual behavior: Setting the vehicle’s body health by SetVehicleBodyHealth will sync it to the clients, but stay the same on the server-side.
Steps to reproduce:
- Spawn into a vehicle.
- Print the vehicle’s body health, both on server and client:
crun print(GetVehicleBodyHealth(GetVehiclePedIsUsing(PlayerPedId())))
// Expected result: 1000.0
run print(GetVehicleBodyHealth(GetVehiclePedIsIn(GetPlayerPed(`your_server_id`))))
// Expected result: 1000.0
- Set the vehicle’s body health (it doesn’t matter if by the server-sided natives nor the clients’):
crun SetVehicleBodyHealth(GetVehiclePedIsUsing(PlayerPedId()), 900.0)
- Check the vehicle’s body health again just as it was done in step 2:
crun print(GetVehicleBodyHealth(GetVehiclePedIsUsing(PlayerPedId())))
// Expected result: 900.0
run print(GetVehicleBodyHealth(GetVehiclePedIsIn(GetPlayerPed(`your_server_id`))))
// Expected result: 1000.0 (Here you can see the desync)
- Damage the vehicle (drive into a wall or something), and check again the values (let’s suppose the damage was 50):
crun print(GetVehicleBodyHealth(GetVehiclePedIsUsing(PlayerPedId())))
// Expected result: 850.0
run print(GetVehicleBodyHealth(GetVehiclePedIsIn(GetPlayerPed(`your_server_id`))))
// Expected result: 950.0 (You can see that it still kinda sync, but only to real
// damage.
Server/Client? Server
If any more information is needed, let me know.