Open C0DELEVEL opened 2 years ago
This should fix the issue #3706
This should fix the issue #3706
@Proxy-99 Thank you for your contribution, but I don't think this is a good solution (#3706) to this issue. It is useful in some cases, but not necessarily in the one I reported.
Why? Your solution has 2 drawbacks:
My suggestion was to improve the synchronization packets so that it works like turning on nitro on clientside.
setVehicleNitroActivated
) -> sends an analogous packet to players nearby with disabled nitro status in the car.Currently, the logic in the MTA only works halfway - a packet is sent about the activation of nitro, but not about its deactivation.
maybe I should add argument for dimension, if dimension not supplied a packet will be sent to all, so could be optimized a bit
Is your feature request related to a problem? Please describe.
Currently, when nitro in a vehicle is activated (by button or by setVehicleNitroActivated function), this information is synchronized to other players. However, the moment we call setVehicleNitroActivated(vehicle, false) in the driver (which is syncer) - nitro will be disabled only for the driver (as localPlayer which executed this function), for other players it will still be active and cause a lot of desynchronization (acceleration is greater than on syncer side).
Describe the solution you'd like
Synchronize the status of nitro according to the current status of syncer (driver).
Describe alternatives you've considered
Currently, you have to work around this with a script, e.g. manually synchronizing nitro state (mainly off, as on by key is synced correctly) - driver -> server -> players nearby
Additional context
The problem mainly relates to the implementation of nitro on the button - hold = on, release = off. Sample script code that turns off the nitro when you release the button:
function toggleNOS(btn, state) local veh = getPedOccupiedVehicle(localPlayer) if veh and getVehicleController(veh) == localPlayer then if isVehicleNitroActivated(veh) then setVehicleNitroActivated (veh, false) -- <- This should be synced with nearby players, as it is when we set it to true. end end end bindKey("vehicle_fire", "up", toggleNOS)
Security Policy