ADD BENNY'S

This commit is contained in:
renaiku
2017-10-28 20:32:48 +02:00
parent 00767515bd
commit 613af392bf
3 changed files with 324 additions and 88 deletions
+24
View File
@@ -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)