mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-04 16:23:21 +00:00
Fixed NUI limit with too many vehicles in garage
This commit is contained in:
+8
-3
@@ -37,6 +37,8 @@ function OpenVehicleSpawnerMenu(type, hospital, part, partNum)
|
|||||||
|
|
||||||
ESX.TriggerServerCallback('esx_vehicleshop:retrieveJobVehicles', function(jobVehicles)
|
ESX.TriggerServerCallback('esx_vehicleshop:retrieveJobVehicles', function(jobVehicles)
|
||||||
if #jobVehicles > 0 then
|
if #jobVehicles > 0 then
|
||||||
|
local allVehicleProps = {}
|
||||||
|
|
||||||
for k,v in ipairs(jobVehicles) do
|
for k,v in ipairs(jobVehicles) do
|
||||||
local props = json.decode(v.vehicle)
|
local props = json.decode(v.vehicle)
|
||||||
local vehicleName = GetLabelText(GetDisplayNameFromVehicleModel(props.model))
|
local vehicleName = GetLabelText(GetDisplayNameFromVehicleModel(props.model))
|
||||||
@@ -52,8 +54,10 @@ function OpenVehicleSpawnerMenu(type, hospital, part, partNum)
|
|||||||
label = label,
|
label = label,
|
||||||
stored = v.stored,
|
stored = v.stored,
|
||||||
model = props.model,
|
model = props.model,
|
||||||
vehicleProps = props
|
plate = props.plate
|
||||||
})
|
})
|
||||||
|
|
||||||
|
allVehicleProps[props.plate] = props
|
||||||
end
|
end
|
||||||
|
|
||||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_garage', {
|
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_garage', {
|
||||||
@@ -68,9 +72,10 @@ function OpenVehicleSpawnerMenu(type, hospital, part, partNum)
|
|||||||
menu2.close()
|
menu2.close()
|
||||||
|
|
||||||
ESX.Game.SpawnVehicle(data2.current.model, spawnPoint.coords, spawnPoint.heading, function(vehicle)
|
ESX.Game.SpawnVehicle(data2.current.model, spawnPoint.coords, spawnPoint.heading, function(vehicle)
|
||||||
ESX.Game.SetVehicleProperties(vehicle, data2.current.vehicleProps)
|
local vehicleProps = allVehicleProps[data2.current.plate]
|
||||||
|
ESX.Game.SetVehicleProperties(vehicle, vehicleProps)
|
||||||
|
|
||||||
TriggerServerEvent('esx_vehicleshop:setJobVehicleState', data2.current.vehicleProps.plate, false)
|
TriggerServerEvent('esx_vehicleshop:setJobVehicleState', data2.current.plate, false)
|
||||||
ESX.ShowNotification(_U('garage_released'))
|
ESX.ShowNotification(_U('garage_released'))
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user