This commit is contained in:
Miho931 2025-06-08 13:12:49 +02:00
parent 01b5635131
commit 6fd16d35ce
2 changed files with 20 additions and 2 deletions

View file

@ -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