1
0
Fork 0
forked from Simnation/Main

resources/[jobs]/[civ]/mh_jobgarage/client/chiefsettings.lua aktualisiert

This commit is contained in:
Miho 2025-06-25 00:05:02 +02:00
parent be02d05ba8
commit 90cb53a7d3

View file

@ -36,38 +36,28 @@ function OpenChiefMenu(vehicles)
lib.showContext("ChiefSettingsMenu")
end
function IsVehicleSpawned(plate)
local vehicles = GetGamePool('CVehicle')
for _, vehicle in ipairs(vehicles) do
if DoesEntityExist(vehicle) then
local mods = QBCore.Functions.GetVehicleProperties(vehicle)
local vehiclePlate = mods.plate
if vehiclePlate == plate then
print("Function: "..mods)
return true, mods
end
end
end
return false, nil -- Vehicle not found
end
function OpenChiefAddVehicleMenu()
local Player = QBCore.Functions.GetPlayerData()
local opt = {}
QBCore.Functions.TriggerCallback('mh_jobgarage:CallOwnerVehicles', function(vehicles)
Wait(300)
print(json.encode(vehicles))
Wait(300)
print(json.encode(vehicles))
if vehicles ~= false then
local opt = {}
for i = 1, #vehicles, 1 do
local isSpawned, mods = IsVehicleSpawned(vehicles[i].plate)
local isSpawned = false
local mods = {}
local allVehicles = GetGamePool('CVehicle')
for _, v in ipairs(allVehicles) do
if DoesEntityExist(v) then
isSpawned = true
mods = QBCore.Functions.GetVehicleProperties(v)
end
end
if isSpawned then
print("Chiefsettings: "..mods)