HumanTree92/VENT_ESX_Scripts

Broken windows in cars planes & helicopters

Opened this issue · 5 comments

Questions
Which Script are you having Issues with?: esx_advancedgarage
Have you made changes to anything besides the config.lua?: yes
Have you looked through the Closed Topics?: yes
Have you looked through the Wiki?: yes
Are you using a Pre-Installed ESX? If Yes who?: nop
What Verison of ESX Legacy are you using?: 1.8.5
Are you using OneSync?: yes
Linux or Windows?: Windows

Describe the Bug | A Clear & Concise Description of the Bug

When I keep a vehicle in the garage with broken windows, even if I pay to repair it, they appear broken again when I take the vehicle out of the garage

What all changes did u make.

I use ox_fuel in the server that I am creating and I have changed the part of the code of legacy fuel

-- Store Vehicles
function StoreVehicle(vehicle, vehicleProps)
	for k,v in pairs (vehInstance) do
		if ESX.Math.Trim(v.plate) == ESX.Math.Trim(vehicleProps.plate) then
			table.remove(vehInstance, k)
		end
	end

	if Config.Main.LegacyFuel then
		-- local currentFuel = exports['LegacyFuel']:GetFuel(vehicle)
		local currentFuel = GetVehicleFuelLevel(vehicle)
		TriggerServerEvent('esx_advancedgarage:setVehicleFuel', vehicleProps.plate, currentFuel)
	end

	DeleteEntity(vehicle)
	TriggerServerEvent('esx_advancedgarage:setVehicleState', vehicleProps.plate, true)
	ESX.ShowNotification(_U('vehicle_in_garage'))
end

-- Spawn Vehicles
function SpawnVehicle(spawner, heading, vehicle, plate, fuel)
	ESX.Game.SpawnVehicle(vehicle.model, spawner, heading, function(callback_vehicle)
		ESX.Game.SetVehicleProperties(callback_vehicle, vehicle)
		SetVehRadioStation(callback_vehicle, 'OFF')
		SetVehicleFixed(callback_vehicle)
		SetVehicleDeformationFixed(callback_vehicle)
		SetVehicleUndriveable(callback_vehicle, false)
		SetVehicleEngineOn(callback_vehicle, true, true)
		SetEntityAsMissionEntity(callback_vehicle, true, false)
		local carplate = GetVehicleNumberPlateText(callback_vehicle)
		table.insert(vehInstance, {vehicleentity = callback_vehicle, plate = carplate})
		if Config.Main.LegacyFuel then
			-- exports['LegacyFuel']:SetFuel(callback_vehicle, fuel)
			Entity(callback_vehicle).state.fuel = fuel
		end
		TaskWarpPedIntoVehicle(GetPlayerPed(-1), callback_vehicle, -1)
	end)

	TriggerServerEvent('esx_advancedgarage:setVehicleState', plate, false)
end

I am observing in the database that saves the state of the windows (windowsBroken), is it possible that your script is not exporting the values of these props?

{"modEngine":-1,"color2":0,"modRoof":-1,"modSeats":-1,"modShifterLeavers":-1,"modTank":-1,"modAirFilter":-1,"modDoorSpeaker":-1,"modFrame":-1,"modBrakes":-1,"modDoorR":-1,"modExhaust":-1,"modFrontWheels":-1,"tyreBurst":{"1":false,"4":false,"5":false,"0":false},"modHood":-1,"modSuspension":-1,"modFrontBumper":-1,"modTrimA":-1,"modRearBumper":-1,"plate":"NMWU6710","bodyHealth":872.0,"modStruts":-1,"engineHealth":936.0,"model":353883353,"modDial":-1,"modEngineBlock":-1,"modOrnaments":-1,"doorsBroken":{"1":false,"2":false,"0":false},"tankHealth":976.0,"modLivery":0,"extras":{"11":1,"7":1,"1":1,"2":1,"10":1},"modSpeakers":-1,"modSmokeEnabled":false,"windowsBroken":{"5":false,"6":true,"7":true,"0":true,"1":true,"2":true,"3":true,"4":true},"modTurbo":false,"dirtLevel":5.0,"wheelColor":156,"modArchCover":-1,"modBackWheels":-1,"modPlateHolder":-1,"neonColor":[255,0,255],"neonEnabled":[false,false,false,false],"modXenon":false,"fuelLevel":99.9,"tyreSmokeColor":[255,255,255],"modSpoilers":-1,"plateIndex":4,"wheels":0,"modFender":-1,"modAerials":-1,"color1":134,"pearlescentColor":112,"modGrille":-1,"modHorns":-1,"modHydrolic":-1,"windowTint":-1,"xenonColor":255,"modSideSkirt":-1,"modDashboard":-1,"modTrunk":-1,"modArmor":-1,"modRightFender":-1,"modVanityPlate":-1,"modAPlate":-1,"modSteeringWheel":-1,"modTrimB":-1,"modTransmission":-1,"modLightbar":-1}

this is a polmav

The info about a Vehicle is saved & pulled from es_extended. I haven't used the latest ESX. From looking at ESX it looks like In This Update they added Windows, Tires, etc. I haven't tested this at all.

But by default the script should fix the Vehicle. I won't be able to test the newest ESX at least for 2 weeks. As my Dedicated Server has to be completely reuploaded and i am currently working a Construction Job all this week.

Yes, I confirm that the vehicle is repaired, the only problem I have observed is the windows, ok friend, I will keep waiting, I use this script since you published it and I consider it to be the best that exists, blessings, A hug!