Remove QBCore.Functions.ExecuteSql

This commit is contained in:
GhzGarage
2021-08-03 19:22:06 -05:00
parent ab67d6e1cb
commit 2722215aba
3 changed files with 119 additions and 142 deletions
+14 -16
View File
@@ -232,17 +232,16 @@ AddEventHandler('QBCore:ToggleDuty', function()
end)
Citizen.CreateThread(function()
exports.ghmattimysql:execute('SELECT * FROM permissions', function(result)
if result[1] ~= nil then
for k, v in pairs(result) do
QBCore.Config.Server.PermissionList[v.license] = {
license = v.license,
permission = v.permission,
optin = true,
}
end
local result = exports['ghmattimysql']:executeSync('SELECT * FROM permissions')
if result[1] ~= nil then
for k, v in pairs(result) do
QBCore.Config.Server.PermissionList[v.license] = {
license = v.license,
permission = v.permission,
optin = true,
}
end
end)
end
end)
QBCore.Functions.CreateCallback('QBCore:HasItem', function(source, cb, items)
@@ -274,11 +273,10 @@ end)
RegisterServerEvent('QBCore:Command:CheckOwnedVehicle')
AddEventHandler('QBCore:Command:CheckOwnedVehicle', function(VehiclePlate)
if VehiclePlate ~= nil then
exports.ghmattimysql:execute('SELECT * FROM player_vehicles WHERE plate=@plate', {['@plate'] = VehiclePlate}, function(result)
if result[1] ~= nil then
exports.ghmattimysql:execute('UPDATE player_vehicles SET state=@state WHERE citizenid=@citizenid', {['@state'] = 1, ['@citizenid'] = result[1].citizenid})
TriggerEvent('qb-garages:server:RemoveVehicle', result[1].citizenid, VehiclePlate)
end
end)
local result = exports['ghmattimysql']:executeSync('SELECT * FROM player_vehicles WHERE plate=@plate', {['@plate'] = VehiclePlate})
if result[1] ~= nil then
exports.ghmattimysql:execute('UPDATE player_vehicles SET state=@state WHERE citizenid=@citizenid', {['@state'] = 1, ['@citizenid'] = result[1].citizenid})
TriggerEvent('qb-garages:server:RemoveVehicle', result[1].citizenid, VehiclePlate)
end
end
end)