forked from Simnation/Main
Merge branch 'master' of https://git.evolution-state-life.de/Evolution-State-Life/Main
This commit is contained in:
commit
23e76064a9
2 changed files with 60 additions and 57 deletions
|
@ -36,6 +36,26 @@ function OpenChiefMenu(vehicles)
|
||||||
lib.showContext("ChiefSettingsMenu")
|
lib.showContext("ChiefSettingsMenu")
|
||||||
end
|
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()
|
function OpenChiefAddVehicleMenu()
|
||||||
local Player = QBCore.Functions.GetPlayerData()
|
local Player = QBCore.Functions.GetPlayerData()
|
||||||
local opt = {}
|
local opt = {}
|
||||||
|
@ -47,10 +67,9 @@ function OpenChiefAddVehicleMenu()
|
||||||
local opt = {}
|
local opt = {}
|
||||||
|
|
||||||
for i = 1, #vehicles, 1 do
|
for i = 1, #vehicles, 1 do
|
||||||
local isSpawned, mods = IsVehicleSpawned(plate)
|
local isSpawned, mods = IsVehicleSpawned(vehicles[i].plate)
|
||||||
while not isSpawned do
|
|
||||||
Wait(100)
|
if isSpawned then
|
||||||
end
|
|
||||||
print("Chiefsettings: "..mods)
|
print("Chiefsettings: "..mods)
|
||||||
|
|
||||||
table.insert(opt, {
|
table.insert(opt, {
|
||||||
|
@ -89,6 +108,9 @@ function OpenChiefAddVehicleMenu()
|
||||||
})
|
})
|
||||||
|
|
||||||
lib.showContext("ChiefAddVehicleMenu")
|
lib.showContext("ChiefAddVehicleMenu")
|
||||||
|
else
|
||||||
|
Notification("Schlüsselkasten", "Kein Fahrzeug gefunden!", "warning")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
Notification("Schlüsselkasten", "Keine Fahrzeuge von dir Gefunden!", "error")
|
Notification("Schlüsselkasten", "Keine Fahrzeuge von dir Gefunden!", "error")
|
||||||
|
|
|
@ -28,22 +28,3 @@ RegisterNetEvent('mh_jobgarage:notify')
|
||||||
AddEventHandler('mh_jobgarage:notify', function(title, text, type)
|
AddEventHandler('mh_jobgarage:notify', function(title, text, type)
|
||||||
Notification(title, text, type)
|
Notification(title, text, type)
|
||||||
end)
|
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
|
|
Loading…
Add table
Add a link
Reference in a new issue