citizenfx / fivem

The source code for the Cfx.re modification frameworks, such as FiveM, RedM and LibertyM, as well as FXServer.
https://cfx.re/
3.52k stars 2.07k forks source link

GetVehicleModColor_1 #2596

Open francodamian opened 3 months ago

francodamian commented 3 months ago

What happened?

Hi, we have been having reports of players losing the color type of their vehicle, in testing we discovered that the native functions GetVehicleModColor_1 and GetVehicleModColor_2 are not synchronizing between players.

Here are two videos, both players have a loop with the following code, which is the one you see in the console while printing

Citizen.CreateThread(function() while true do local cVeh = GetVehiclePedIsIn(PlayerPedId()) print(GetVehicleModColor_1(cVeh)) Wait(1000) end end)

https://github.com/citizenfx/fivem/assets/32750362/1a86bd21-8ff3-48f2-9442-9b271e781d88 https://github.com/citizenfx/fivem/assets/32750362/49cbfdca-5197-4895-8cad-5a8839ca5304

Expected result

the same value in both players

Reproduction steps

  1. change vehicle color
  2. delete vehicle (using a garage, previously saving the mods in database)
  3. spawn it again and apply the saved properties (up to this point everything works fine).
  4. after creating the vehicle, both players see it the same, but if the entity is spawned by player 1, player 2 gets different values from the native GetVehicleModColor_1 and GetVehicleModColor_2 even if he is seeing the vehicle with the same tuning.

Importancy

Unknown

Area(s)

FiveM, OneSync, Natives

Specific version(s)

3095 - b8509 artifacts (also try old ones, still broken)

Additional information

No response

francodamian commented 3 months ago

We already try some things

  1. spawn vehicle in server side and clien side.
  2. force to transfer owner of networked entity.

none of them work

tens0rfl0w commented 3 months ago

Mod colors aren't part of the sync data so this is expected behavior. You either need to use other natives like GetVehicleColours (still differentiates between color types) or sync this data yourself (via state bags for example).

ahcenezdh commented 3 months ago

Mod colors aren't part of the sync data so this is expected behavior. You either need to use other natives like GetVehicleColours (still differentiates between color types) or sync this data yourself (via state bags for example).

Is it possible to add mod colors into the sync data?