mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-04 16:23:21 +00:00
Proper cb usage
This commit is contained in:
+14
-14
@@ -24,21 +24,21 @@ ESX.RegisterServerCallback('esx_boat:buyBoat', function(source, cb, vehicleProps
|
|||||||
if price == 0 then
|
if price == 0 then
|
||||||
print(('esx_boat: %s attempted to exploit the shop! (invalid vehicle model)'):format(xPlayer.identifier))
|
print(('esx_boat: %s attempted to exploit the shop! (invalid vehicle model)'):format(xPlayer.identifier))
|
||||||
cb(false)
|
cb(false)
|
||||||
end
|
|
||||||
|
|
||||||
if xPlayer.getMoney() >= price then
|
|
||||||
xPlayer.removeMoney(price)
|
|
||||||
|
|
||||||
MySQL.Async.execute('INSERT INTO owned_vehicles (owner, plate, vehicle, type) VALUES (@owner, @plate, @vehicle, @type)', {
|
|
||||||
['@owner'] = xPlayer.identifier,
|
|
||||||
['@plate'] = vehicleProps.plate,
|
|
||||||
['@vehicle'] = json.encode(vehicleProps),
|
|
||||||
['@type'] = 'boat'
|
|
||||||
}, function(rowsChanged)
|
|
||||||
cb(true)
|
|
||||||
end)
|
|
||||||
else
|
else
|
||||||
cb(false)
|
if xPlayer.getMoney() >= price then
|
||||||
|
xPlayer.removeMoney(price)
|
||||||
|
|
||||||
|
MySQL.Async.execute('INSERT INTO owned_vehicles (owner, plate, vehicle, type) VALUES (@owner, @plate, @vehicle, @type)', {
|
||||||
|
['@owner'] = xPlayer.identifier,
|
||||||
|
['@plate'] = vehicleProps.plate,
|
||||||
|
['@vehicle'] = json.encode(vehicleProps),
|
||||||
|
['@type'] = 'boat'
|
||||||
|
}, function(rowsChanged)
|
||||||
|
cb(true)
|
||||||
|
end)
|
||||||
|
else
|
||||||
|
cb(false)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user