[Garage]
This commit is contained in:
parent
01b5635131
commit
6fd16d35ce
2 changed files with 20 additions and 2 deletions
|
@ -12,7 +12,7 @@ Citizen.CreateThread(function()
|
|||
end)
|
||||
|
||||
-- Funktion zum Spawnen des NPCs
|
||||
local function SpawnGuardNPC(npc)
|
||||
function SpawnGuardNPC(npc)
|
||||
-- Ped Model laden
|
||||
RequestModel(npc.model)
|
||||
while not HasModelLoaded(npc.model) do
|
||||
|
@ -38,7 +38,7 @@ local function SpawnGuardNPC(npc)
|
|||
end
|
||||
|
||||
-- Funktion zum Entfernen des NPCs
|
||||
local function RemoveGuardNPC()
|
||||
function RemoveGuardNPC()
|
||||
if DoesEntityExist(npcHandle) then
|
||||
DeleteEntity(npcHandle)
|
||||
isNPCSpawned = false
|
||||
|
@ -59,8 +59,10 @@ CreateThread(function()
|
|||
print("spawnDistance: "..spawnDistance)
|
||||
|
||||
if dist < spawnDistance and not isNPCSpawned then
|
||||
print("Trigger")
|
||||
SpawnGuardNPC(v.NPC)
|
||||
elseif dist > spawnDistance and isNPCSpawned then
|
||||
print("Distrigger")
|
||||
RemoveGuardNPC()
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue