sv_utils.lua
local myframework = nil
CreateThread(function()
if not myframework then
if GetResourceState("qbx_core") == "started" then
myframework = "qb"
elseif GetResourceState("es_extended") == "started" then
myframework = "esx"
elseif GetResourceState("qb-core") == "started" then
myframework = "qb"
end
end
end)
function addVehicleToGarage(player, carData, name)
local _player = player
local license = getPlayerLicense(_player)
local cid = CORE:GetCitizenId(_player)
if myframework == "qb" then
CORE:ExecuteSql("INSERT INTO player_vehicles (license, citizenid, vehicle, hash, mods, plate, garage, state) VALUES ('"..license.."', '"..cid.."', '"..name.."', '"..GetHashKey(name).."', '"..json.encode(carData).."', '"..carData.plate.."', '', '0')")
else
CORE:ExecuteSql("INSERT INTO owned_vehicles (owner, plate, vehicle, type, stored) VALUES ('"..cid.."', '"..carData.plate.."', '"..json.encode(carData).."', 'vehicle', '1')")
end
end
function getPlayerLicense(player)
local identifiers = GetPlayerIdentifiers(player)
for _, id in ipairs(identifiers) do
if string.match(id, 'license') then
return id
end
end
return nil
end
function IsPlayerAdmin(playerid)
return IsPlayerAceAllowed(playerid, "admin")
endLast updated