Proper cb usage

This commit is contained in:
ElPumpo
2019-05-05 10:01:03 +02:00
parent 161ced8393
commit 181f060a18
+16 -16
View File
@@ -119,23 +119,23 @@ ESX.RegisterServerCallback('esx_ambulancejob:buyJobVehicle', function(source, cb
if price == 0 then
print(('esx_ambulancejob: %s attempted to exploit the shop! (invalid vehicle model)'):format(xPlayer.identifier))
cb(false)
end
if xPlayer.getMoney() >= price then
xPlayer.removeMoney(price)
MySQL.Async.execute('INSERT INTO owned_vehicles (owner, vehicle, plate, type, job, `stored`) VALUES (@owner, @vehicle, @plate, @type, @job, @stored)', {
['@owner'] = xPlayer.identifier,
['@vehicle'] = json.encode(vehicleProps),
['@plate'] = vehicleProps.plate,
['@type'] = type,
['@job'] = xPlayer.job.name,
['@stored'] = true
}, function (rowsChanged)
cb(true)
end)
else
cb(false)
if xPlayer.getMoney() >= price then
xPlayer.removeMoney(price)
MySQL.Async.execute('INSERT INTO owned_vehicles (owner, vehicle, plate, type, job, `stored`) VALUES (@owner, @vehicle, @plate, @type, @job, @stored)', {
['@owner'] = xPlayer.identifier,
['@vehicle'] = json.encode(vehicleProps),
['@plate'] = vehicleProps.plate,
['@type'] = type,
['@job'] = xPlayer.job.name,
['@stored'] = true
}, function (rowsChanged)
cb(true)
end)
else
cb(false)
end
end
end)