Hi,
I just started scripting a server on FiveM, and I was trying to make my own lock/unlock vehicle system (without any menu or command).
The main method I used to do that is this simple one :
-- To lock
SetVehicleDoorsLocked(vehicle, 2)
-- To unlock
SetVehicleDoorsLocked(vehicle, 0)
Sounds pretty obvious, and as I understand, everyone uses this method.
But after many simple tests, on 2 machines, I noticed that when two clients alternatively lock/unlock one car, the “DoorsLock” parameter gets unsynced between clients.
For exemple :
-
Client 1 takes a random car
– DoorsLocked = 0 for both players – -
Client 1 locks the car
– DoorsLocked = 2 for both players – -
Client 1 unlocks the car
– DoorsLocked = 0 for both players –
==> So far so good -
Client 2 locks the car
– DoorsLocked = 0 for Client 1 –
– DoorsLocked = 2 for Client 2 –
==> Sync problem
At this point, the DoorsLocked flag has two different values, and get synced when one client tries to enter the vehicle :
- if client 1 enters the vehicle
– DoorsLocked = 0 for both clients – - if client 2 try to enter the vehicle
– DoorsLocked = 2 for both clients –
It seems that this bug can be reproduced with Vehicle Controls GUI v2 too, and I was wondering if it was a common problem with FiveM, or if I was the only one with this bug (before posting it in the “Bug reports” section)