diff --git a/resources/[jobs]/[civ]/mh_jobgarage/client/function.lua b/resources/[jobs]/[civ]/mh_jobgarage/client/function.lua index e83480318..ca519e3fe 100644 --- a/resources/[jobs]/[civ]/mh_jobgarage/client/function.lua +++ b/resources/[jobs]/[civ]/mh_jobgarage/client/function.lua @@ -1,30 +1,50 @@ -function Notification(title, text, type) - lib.notify({ - title = title, - description = text, - type = type, - position = 'top', - }) -end - -function TextUI(value, text) - if value then - lib.showTextUI(text, { - position = "top-center", - icon = 'hand', - style = { - borderRadius = 0, - backgroundColor = '#48BB78', - color = 'white' - } - }) - else - lib.hideTextUI() - end -end - ----------------------------- NetEvents -RegisterNetEvent('mh_jobgarage:notify') -AddEventHandler('mh_jobgarage:notify', function(title, text, type) - Notification(title, text, type) -end) \ No newline at end of file +function Notification(title, text, type) + lib.notify({ + title = title, + description = text, + type = type, + position = 'top', + }) +end + +function TextUI(value, text) + if value then + lib.showTextUI(text, { + position = "top-center", + icon = 'hand', + style = { + borderRadius = 0, + backgroundColor = '#48BB78', + color = 'white' + } + }) + else + lib.hideTextUI() + end +end + +---------------------------- NetEvents +RegisterNetEvent('mh_jobgarage:notify') +AddEventHandler('mh_jobgarage:notify', function(title, text, type) + Notification(title, text, type) +end) + +function IsVehicleSpawned(plate) + plate = string.gsub(string.upper(plate), '^%s*(.-)%s*$', '%1'):gsub(' ', '') + + local vehicles = GetAllVehicles() + + for _, vehicle in ipairs(vehicles) do + if DoesEntityExist(vehicle) then + local vehiclePlate = QBCore.Functions.GetPlate(vehicle) + local mods = QBCore.Functions.GetVehicleProperties(vehicle) + vehiclePlate = string.gsub(string.upper(vehiclePlate), '^%s*(.-)%s*$', '%1'):gsub(' ', '') + + if vehiclePlate == plate then + return true, mods + end + end + end + + return false, nil -- Vehicle not found +end \ No newline at end of file