1
0
Fork 0
forked from Simnation/Main

Update main.lua

This commit is contained in:
Miho931 2025-06-08 13:38:53 +02:00
parent 6fd16d35ce
commit 6ac3871e97

View file

@ -17,11 +17,12 @@ function SpawnGuardNPC(npc)
RequestModel(npc.model)
while not HasModelLoaded(npc.model) do
Wait(1)
print("Model is Loading...")
end
-- NPC erstellen
npcHandle = CreatePed(4, npc.model, npc.spawn.x, npc.spawn.y, npc.spawn.x, npc.spawn.w, false, true)
print("NPC Sollte stehen!")
-- NPC Eigenschaften setzen
SetEntityAsMissionEntity(npcHandle, true, true)
SetBlockingOfNonTemporaryEvents(npcHandle, true)
@ -54,15 +55,10 @@ CreateThread(function()
for k, v in pairs(Config.Zonen) do
local dist = #(playerCoords - vector3(v.NPC.spawn.x, v.NPC.spawn.y, v.NPC.spawn.z))
local spawnDistance = v.NPC.distance
print("PlayerCoords: "..playerCoords)
print("dist: "..dist)
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