mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-04 16:23:21 +00:00
ADD BENNY'S
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
ESX = nil
|
||||
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
|
||||
local Vehicles = nil
|
||||
|
||||
RegisterServerEvent('esx_lscustom:buyMod')
|
||||
AddEventHandler('esx_lscustom:buyMod', function(price)
|
||||
@@ -25,4 +26,27 @@ AddEventHandler('esx_lscustom:refreshOwnedVehicle', function(myCar)
|
||||
['@vehicle'] = json.encode(myCar)
|
||||
}
|
||||
)
|
||||
end)
|
||||
|
||||
ESX.RegisterServerCallback('esx_lscustom:getVehiclesPrices', function(source, cb)
|
||||
|
||||
if Vehicles == nil then
|
||||
MySQL.Async.fetchAll(
|
||||
'SELECT * FROM vehicles',
|
||||
{},
|
||||
function(result)
|
||||
local vehicles = {}
|
||||
for i=1, #result, 1 do
|
||||
table.insert(vehicles,{
|
||||
model = result[i].model,
|
||||
price = result[i].price
|
||||
})
|
||||
end
|
||||
Vehicles = vehicles
|
||||
cb(Vehicles)
|
||||
end
|
||||
)
|
||||
else
|
||||
cb(Vehicles)
|
||||
end
|
||||
end)
|
||||
Reference in New Issue
Block a user