You want to have the config file to hold the model of the car and you want to get the name out of the database or you want to build an array of vehicle model and name from the database?
Take a look at this server callback in the current esx_garage, it would be a perfect starting point for modifying to build an array of vehicles for use in the manner you’re wanting to:
ESX.RegisterServerCallback('esx_vehicleshop:getVehiclesInGarage', function(source, cb, garage)
local xPlayer = ESX.GetPlayerFromId(source)
MySQL.query('SELECT * FROM `user_parkings` WHERE `identifier` = @identifier AND garage = @garage',
{
['@identifier'] = xPlayer.identifier,
['@garage'] = garage
}, function(result)
local vehicles = {}
for i=1, #result, 1 do
table.insert(vehicles, {
zone = result[i].zone,
vehicle = json.decode(result[i].vehicle)
})
end
cb(vehicles)
end)
end)
Just putting that in a server file won’t do anything helpful for you, you need to modify it to grab what you want. As for the client file, you would want to replace the config’s vehicle building portion with a client function that triggers this event to build the config array.