Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function ListVehiclesMenu()
- local elements = {}
- ESX.TriggerServerCallback('eden_garage:getVehicles',
- function(vehicles)
- for _,v in pairs(vehicles) do
- local comment = v.comment
- local hashVehicule = v.vehicle.model
- local vehicleName = GetDisplayNameFromVehicleModel(hashVehicule)
- local labelvehicle
- local plate = v.plate
- if(v.state)then
- labelvehicle = comment.. ' |' .. vehicleName.. ' [' .. plate .. '] ' .._U('garage')
- else
- labelvehicle = comment.. ' |' .. vehicleName.. ' [' .. plate .. '] ' .._U('municipal_pound')
- end
- table.insert(elements, {label =labelvehicle , value = v})
- end
- local c = 0
- for _,a in pairs(vehicles) do
- if (a.state) then
- c = c + 1
- else
- c = c - 1
- end
- end
- ESX.UI.Menu.Open(
- 'default', GetCurrentResourceName(), 'spawn_vehicle',
- {
- title = _U('garage'),
- align = 'top-left',
- elements = elements,
- },
- function(data, menu)
- if(data.current.value.state)then
- if c > 0 then
- menu.close()
- ESX.UI.Menu.CloseAll()
- local elements = {
- {label = _U('spawn_the_vehicle'), value = 'yes'},
- {label = _U('add_comment'), value = 'no'},
- }
- ESX.UI.Menu.Open(
- 'default', GetCurrentResourceName(), 'delete_menu',
- {
- title = ('Car options'.. ' | ' .. data.current.value.plate),
- align = 'center',
- elements = elements,
- },
- function(data, menu, vehicles)
- menu.close()
- if(data.current.value == 'yes') then
- SpawnVehicle(data.current.value.vehicle, data.current.value.plate)
- end
- if(data.current.value == 'no') then
- ESX.ShowNotification(_U('visit_mechanic'))
- end
- end,
- function(data, menu)
- menu.close()
- end
- )
- else
- TriggerEvent('esx:showNotification', _U('vehicle_is_impounded'))
- end
- end --if
- end, -- end of function :211
- function(data, menu)
- menu.close()
- --CurrentAction = 'open_garage_action'
- end
- )
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement