mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-01 10:48:52 +00:00
Support for latest ESX
This commit is contained in:
+14
-7
@@ -28,11 +28,12 @@ ESX.RegisterServerCallback('esx_boat:buyBoat', function(source, cb, vehicleProps
|
||||
if xPlayer.getMoney() >= price then
|
||||
xPlayer.removeMoney(price)
|
||||
|
||||
MySQL.Async.execute('INSERT INTO owned_vehicles (owner, plate, vehicle, type) VALUES (@owner, @plate, @vehicle, @type)', {
|
||||
MySQL.Async.execute('INSERT INTO owned_vehicles (owner, plate, vehicle, type, `stored`) VALUES (@owner, @plate, @vehicle, @type, @stored)', {
|
||||
['@owner'] = xPlayer.identifier,
|
||||
['@plate'] = vehicleProps.plate,
|
||||
['@vehicle'] = json.encode(vehicleProps),
|
||||
['@type'] = 'boat'
|
||||
['@type'] = 'boat',
|
||||
['@stored'] = true
|
||||
}, function(rowsChanged)
|
||||
cb(true)
|
||||
end)
|
||||
@@ -44,25 +45,29 @@ end)
|
||||
|
||||
RegisterServerEvent('esx_boat:takeOutVehicle')
|
||||
AddEventHandler('esx_boat:takeOutVehicle', function(plate)
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
MySQL.Async.execute('UPDATE owned_vehicles SET `stored` = @stored WHERE owner = @owner AND plate = @plate', {
|
||||
['@stored'] = false,
|
||||
['@owner'] = GetPlayerIdentifiers(source)[1],
|
||||
['@owner'] = xPlayer.identifier,
|
||||
['@plate'] = plate
|
||||
}, function(rowsChanged)
|
||||
if rowsChanged == 0 then
|
||||
print(('esx_boat: %s exploited the garage!'):format(GetPlayerIdentifiers(source)[1]))
|
||||
print(('esx_boat: %s exploited the garage!'):format(xPlayer.identifier))
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
ESX.RegisterServerCallback('esx_boat:storeVehicle', function (source, cb, plate)
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
MySQL.Async.execute('UPDATE owned_vehicles SET `stored` = @stored WHERE owner = @owner AND plate = @plate', {
|
||||
['@stored'] = true,
|
||||
['@owner'] = GetPlayerIdentifiers(source)[1],
|
||||
['@owner'] = xPlayer.identifier,
|
||||
['@plate'] = plate
|
||||
}, function(rowsChanged)
|
||||
if rowsChanged == 0 then
|
||||
print(('esx_boat: %s attempted to store an boat they don\'t own!'):format(GetPlayerIdentifiers(source)[1]))
|
||||
print(('esx_boat: %s attempted to store an boat they don\'t own!'):format(xPlayer.identifier))
|
||||
end
|
||||
|
||||
cb(rowsChanged)
|
||||
@@ -70,8 +75,10 @@ ESX.RegisterServerCallback('esx_boat:storeVehicle', function (source, cb, plate)
|
||||
end)
|
||||
|
||||
ESX.RegisterServerCallback('esx_boat:getGarage', function(source, cb)
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
MySQL.Async.fetchAll('SELECT vehicle FROM owned_vehicles WHERE owner = @owner AND type = @type AND `stored` = @stored', {
|
||||
['@owner'] = GetPlayerIdentifiers(source)[1],
|
||||
['@owner'] = xPlayer.identifier,
|
||||
['@type'] = 'boat',
|
||||
['@stored'] = true
|
||||
}, function(result)
|
||||
|
||||
Reference in New Issue
Block a user