You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On our server, vehicles are spawned server-side using the CreateVehicle native function, and we request that the entity owner applies both visual and performance modifications. Visual modifications, such as bumpers, spoilers, colors, liveries, and others, are applied correctly. Performance modifications (engine, brakes, transmission, suspension, and turbo) also seem to be applied successfully. In all cases, the native function GetVehicleMod returns the expected values for these modifications. However, when driving the vehicle, we notice that its performance is significantly below expectations. Despite the modifications being present, they don't seem to have the intended effect on the vehicle's performance.
We've managed to work around this issue by creating a handler for the game event CEventNetworkPlayerEnteredVehicle, which reapplies the modifications when the player enters the vehicle and starts the engine. The implementation looks like this:
_AEH("gameEventTriggered", function(eventName, eventArgs)
if eventName ~= "CEventNetworkPlayerEnteredVehicle" then return end
if eventArgs[1] ~= 128 then return end
if not eventSpamChecker(eventName) then return end
while GetVehiclePedIsEntering(PlayerPedId()) > 0 do
Wait(100)
end
if GetPedInVehicleSeat(eventArgs[2], -1) ~= PlayerPedId() then return end
repeat
Wait(0)
if not DoesEntityExist(eventArgs[2]) or GetVehiclePedIsUsing(PlayerPedId()) ~= eventArgs[2] then return end
until GetIsVehicleEngineRunning(eventArgs[2])
SetVehicleMod(eventArgs[2], 11, GetVehicleMod(eventArgs[2], 11)) -- Engine
SetVehicleMod(eventArgs[2], 12, GetVehicleMod(eventArgs[2], 12)) -- Brakes
SetVehicleMod(eventArgs[2], 13, GetVehicleMod(eventArgs[2], 13)) -- Transmission
SetVehicleMod(eventArgs[2], 15, GetVehicleMod(eventArgs[2], 15)) -- Suspension
SetVehicleMod(eventArgs[2], 16, GetVehicleMod(eventArgs[2], 16)) -- Armor
ToggleVehicleMod(eventArgs[2], 18, IsToggleModOn(eventArgs[2], 18)) -- Turbo
end)
This ensures that the vehicle's performance modifications are properly applied when the player is inside the vehicle and ready to drive, effectively resolving the issue and restoring the vehicle's expected performance.
Expected result
Performance modifications should take effect on the vehicle when set.
What happened?
On our server, vehicles are spawned server-side using the
CreateVehicle
native function, and we request that the entity owner applies both visual and performance modifications. Visual modifications, such as bumpers, spoilers, colors, liveries, and others, are applied correctly. Performance modifications (engine, brakes, transmission, suspension, and turbo) also seem to be applied successfully. In all cases, the native functionGetVehicleMod
returns the expected values for these modifications. However, when driving the vehicle, we notice that its performance is significantly below expectations. Despite the modifications being present, they don't seem to have the intended effect on the vehicle's performance.We've managed to work around this issue by creating a handler for the game event
CEventNetworkPlayerEnteredVehicle
, which reapplies the modifications when the player enters the vehicle and starts the engine. The implementation looks like this:Without reapply modifications:
https://drive.google.com/file/d/1xlRDZ6WQ-RKeZt6fhAvm0GYQJ_y1cipA/view?usp=sharing
Reapplying modifications:
https://drive.google.com/file/d/16xkps8NmFiL-scZvjHUXa0LX4BB_DnNm/view?usp=sharing
This ensures that the vehicle's performance modifications are properly applied when the player is inside the vehicle and ready to drive, effectively resolving the issue and restoring the vehicle's expected performance.
Expected result
Performance modifications should take effect on the vehicle when set.
Reproduction steps
CreateVehicle
Importancy
There's a workaround
Area(s)
FiveM
Specific version(s)
FiveM 9517 canary, Server 9404 windows
Additional information
No response
The text was updated successfully, but these errors were encountered: