if Config.Framework ~= 'esx' then return end ESX = exports['es_extended']:getSharedObject() RegisterNetEvent('esx:playerLoaded') AddEventHandler('esx:playerLoaded', function(playerData) PlayerData = playerData Debug('player loaded', json.encode(playerData)) end) CreateThread(function() PlayerData = GetPlayerData() Debug('init playerData') end) RegisterNetEvent('esx:setJob', function(jobData) PlayerData.job = jobData end) function TriggerServerCallback(name, cb, ...) ESX.TriggerServerCallback(name, cb, ...) end function GetPlayerData() return ESX.GetPlayerData() end function GetPlayers() return ESX.Game.GetPlayers() end function GetPlayerIdentifier() return GetPlayerData().identifier end function GetJobName() return PlayerData?.job?.name or 'unemployed' end function GetJobGrade() return PlayerData?.job?.grade or 0 end local hasGang = GetResourceState('qs-gangs') == 'started' Gang = nil if hasGang then RegisterNetEvent('gangs:setGang', function(gang) Gang = gang end) end function GetGang() if not hasGang then return { name = '', grades = {} } end if Gang then return Gang end local gang = exports['qs-gangs']:GetGang() Gang = gang if not gang then return { name = '', grades = {} } end return gang end function DrawMarkerZone(x, y, z) DrawMarker(1, x, y, z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.0, 4.0, 0.8, 255, 255, 255, 150, false, false, false, true, false, false, false) end function SpawnGiveVehicle(model, generatedPlate, playerID, playerName, vehicleType, addcommand) local playerPed = cache.ped local coords = GetEntityCoords(playerPed) ESX.Game.SpawnVehicle(model, coords, 0.0, function(vehicle) if DoesEntityExist(vehicle) then local carExist = true SetEntityVisible(vehicle, false) SetEntityCollision(vehicle, false) local newPlate = generatedPlate local vehicleProps = ESX.Game.GetVehicleProperties(vehicle) vehicleProps.plate = newPlate TriggerServerEvent('advancedgarages:server:setVehicle', vehicleProps, model, playerID, vehicleType, addcommand) end end) end function SpawnVehicleEvents(vehicle, plate) if GetResourceState(Config.Framework .. '-wheelstancer') == 'started' then -- You can ignore this, it only works with tuff-wheelstancer TriggerServerCallback('advancedgarages:server:GetStanceValues', function(stance_value) if stance_value ~= nil then Wait(500) local veh = cache.vehicle TriggerServerEvent('Stancer_sv:LoadStanceValues', stance_value, VehToNet(veh)) end end, plate) end -- You can add your events here when the vehicle spawns end function GetVehiclePropertiesFramework(vehicle) return ESX.Game.GetVehicleProperties(vehicle) end function SetVehiclePropertiesFramework(vehicle, props) ESX.Game.SetVehicleProperties(vehicle, props) end function ToggleHud(show) if GetResourceState('qs-interface') == 'started' then exports['qs-interface']:ToggleHud(show) end end function Notification(msg, type) SendReactMessage('notification', { msg = msg, type = type }) -- if GetResourceState('qs-interface') == 'started' then -- if type == 'info' then -- exports['qs-interface']:AddNotify(msg, 'Inform', 2500, 'fas fa-file') -- elseif type == 'error' then -- exports['qs-interface']:AddNotify(msg, 'Error', 2500, 'fas fa-bug') -- elseif type == 'success' then -- exports['qs-interface']:AddNotify(msg, 'Success', 2500, 'fas fa-thumbs-up') -- end -- return -- end -- if type == 'info' then -- lib.notify({ -- title = 'Garages', -- description = msg, -- type = 'info' -- }) -- elseif type == 'error' then -- lib.notify({ -- title = 'Garages', -- description = msg, -- type = 'error' -- }) -- elseif type == 'success' then -- lib.notify({ -- title = 'Garages', -- description = msg, -- type = 'success' -- }) -- end end function ShowHelpNotification(msg, thisFrame, beep, duration) AddTextEntry('HelpNotification', msg) if thisFrame then DisplayHelpTextThisFrame('HelpNotification', false) else if beep == nil then beep = true end BeginTextCommandDisplayHelp('HelpNotification') EndTextCommandDisplayHelp(0, false, beep, duration or -1) end end local texts = {} if GetResourceState('qs-textui') == 'started' then function DrawText3D(x, y, z, text, id, key, theme) local _id = key if not texts[_id] then CreateThread(function() texts[_id] = 5 while texts[_id] > 0 do texts[_id] = texts[_id] - 1 Wait(0) end texts[_id] = nil exports['qs-textui']:DeleteDrawText3D(id) Debug('Deleted text', id) end) Debug('Created text', id) TriggerEvent('textui:DrawText3D', x, y, z, text, id, key, theme) end texts[_id] = 5 end else function DrawText3D(x, y, z, text) SetTextScale(0.35, 0.35) SetTextFont(4) SetTextProportional(1) SetTextColour(255, 255, 255, 215) SetTextEntry('STRING') SetTextCentre(true) AddTextComponentString(text) SetDrawOrigin(x, y, z, 0) DrawText(0.0, 0.0) local factor = text:len() / 370 DrawRect(0.0, 0.0 + 0.0125, 0.017 + factor, 0.03, 0, 0, 0, 75) ClearDrawOrigin() end end