forked from Simnation/Main
Update main.lua
This commit is contained in:
parent
c301b8407a
commit
580a854ab5
1 changed files with 36 additions and 26 deletions
|
@ -449,36 +449,46 @@ CreateThread(function()
|
||||||
-- Wait for target system to be ready
|
-- Wait for target system to be ready
|
||||||
Wait(1000)
|
Wait(1000)
|
||||||
|
|
||||||
-- Add target for all container types
|
-- Check if Config.ContainerTypes exists and is not empty
|
||||||
for _, containerType in pairs(Config.ContainerTypes) do
|
if Config.ContainerTypes and next(Config.ContainerTypes) then
|
||||||
exports['qb-target']:AddTargetModel(containerType.model, {
|
-- Add target for all container types
|
||||||
options = {
|
for _, containerType in pairs(Config.ContainerTypes) do
|
||||||
{
|
exports['qb-target']:AddTargetModel(containerType.model, {
|
||||||
type = "client",
|
options = {
|
||||||
event = "container_heist:client:startRobbery",
|
{
|
||||||
icon = "fas fa-angle-double-right",
|
type = "client",
|
||||||
label = "Break into " .. containerType.label,
|
event = "container_heist:client:startRobbery",
|
||||||
containerType = containerType,
|
icon = "fas fa-angle-double-right",
|
||||||
}
|
label = "Break into " .. containerType.label,
|
||||||
},
|
containerType = containerType,
|
||||||
distance = 3.0
|
}
|
||||||
})
|
},
|
||||||
|
distance = 3.0
|
||||||
|
})
|
||||||
|
end
|
||||||
|
else
|
||||||
|
print("[Container Heist] Error: Config.ContainerTypes is nil or empty!")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Spawn containers at fixed locations if configured
|
-- Check if Config.ContainerLocations exists and is not empty
|
||||||
for _, location in pairs(Config.ContainerLocations) do
|
if Config.ContainerLocations and next(Config.ContainerLocations) then
|
||||||
if location.spawnContainer then
|
-- Spawn containers at fixed locations if configured
|
||||||
local hash = GetHashKey(location.model)
|
for _, location in pairs(Config.ContainerLocations) do
|
||||||
RequestModel(hash)
|
if location.spawnContainer then
|
||||||
while not HasModelLoaded(hash) do
|
local hash = GetHashKey(location.model)
|
||||||
Wait(10)
|
RequestModel(hash)
|
||||||
|
while not HasModelLoaded(hash) do
|
||||||
|
Wait(10)
|
||||||
|
end
|
||||||
|
|
||||||
|
local container = CreateObject(hash, location.coords.x, location.coords.y, location.coords.z, true, false, false)
|
||||||
|
SetEntityHeading(container, location.heading)
|
||||||
|
FreezeEntityPosition(container, true)
|
||||||
|
SetModelAsNoLongerNeeded(hash)
|
||||||
end
|
end
|
||||||
|
|
||||||
local container = CreateObject(hash, location.coords.x, location.coords.y, location.coords.z, true, false, false)
|
|
||||||
SetEntityHeading(container, location.heading)
|
|
||||||
FreezeEntityPosition(container, true)
|
|
||||||
SetModelAsNoLongerNeeded(hash)
|
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
print("[Container Heist] Warning: Config.ContainerLocations is nil or empty!")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue