forked from Simnation/Main
Merge branch 'master' of https://git.evolution-state-life.de/Evolution-State-Life/Main
This commit is contained in:
commit
c122190a68
1 changed files with 13 additions and 23 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue