The SetVehicleAutoRepairDisabled native still repairs the vehicle the player is in.
SetVehicleAutoRepairDisabled(vehicle, true)
Is this a known bug? Or how to make it so the car doenst get fixed? No other “fix” or “repair” terms in the code!
The SetVehicleAutoRepairDisabled native still repairs the vehicle the player is in.
SetVehicleAutoRepairDisabled(vehicle, true)
Is this a known bug? Or how to make it so the car doenst get fixed? No other “fix” or “repair” terms in the code!
What’s your use case and why is the vehicle getting “fixed”? That requires some other action, without sharing what that is and what you’re trying to achieve nobody can possibly help you
It is an ELS system which toggles extra’s. Nowehere in the script is a fix or repair mentioned, still, it keeps repairing the vehicle when the lights are on (toggling extra’s).
Enabling an extra on a vehicle repairs it, that’s base game behavior and it cannot be prevented in any way. If it’s an issue for your players, disable the ability to apply extras when the vehicle is damaged instead
With qb-radialmenu I am able to do that.
-- [...]
RegisterNetEvent('qb-radialmenu:client:setExtra', function(data)
local string = data.id
local replace = string:gsub('extra', '')
local extra = tonumber(replace)
local ped = PlayerPedId()
local veh = GetVehiclePedIsIn(ped)
if veh ~= nil then
if GetPedInVehicleSeat(veh, -1) == ped then
SetVehicleAutoRepairDisabled(veh, true) -- Forces Auto Repair off when Toggling Extra [GTA 5 Niche Issue]
if DoesExtraExist(veh, extra) then
if IsVehicleExtraTurnedOn(veh, extra) then
SetVehicleExtra(veh, extra, 1)
else
SetVehicleExtra(veh, extra, 0)
end
else
-- error notify
end
else
QBCore.Functions.Notify(Lang:t('error.not_driver'), 'error', 2500)
end
end
end)
But in my ELS:
-- [...]
SetVehicleAutoRepairDisabled(vehicle, true)
local intensityMultiplier = GetIntensityMultiplier(GetClockHours())
local vehicleExtras = Config.Vehicles[vehicleModel].Extras
for extra, pattern in pairs(patternTable) do
CreateThread(function()
local shouldThreadBeActive = true
local extraHasLightEnabled = false
CreateThread(function()
while shouldThreadBeActive do
Wait(0)
for key, disableExtra in pairs(pattern) do
if (not shouldThreadBeActive) then break end
SetVehicleExtra(vehicle, extra, disableExtra)
-- [...]
It doesn’t work? Would you know how this comes?