1
0
Fork 0
forked from Simnation/Main

Update main.lua

This commit is contained in:
Miho931 2025-06-08 13:53:03 +02:00
parent 9a36f57082
commit 13431ff326

View file

@ -18,34 +18,27 @@ function SpawnGuardNPC(npc)
local timeout = 0
while not HasModelLoaded(npc.model) and timeout < 100 do
timeout = timeout + 1
print("Warte auf Model-Load...")
Wait(100)
end
if not HasModelLoaded(npc.model) then
print("Model konnte nicht geladen werden!")
return
end
print("Model erfolgreich geladen, erstelle NPC...")
-- NPC erstellen
npcHandle = CreatePed(4, npc.model, npc.spawn.x, npc.spawn.y, npc.spawn.z, npc.spawn.w, false, true)
if not DoesEntityExist(npcHandle) then
print("NPC konnte nicht erstellt werden!")
return
end
print("NPC erfolgreich erstellt mit Handle: " .. tostring(npcHandle))
-- NPC Eigenschaften setzen
SetEntityAsMissionEntity(npcHandle, true, true)
SetPedDefaultComponentVariation(npcHandle)
--[[ SetEntityAsMissionEntity(npcHandle, true, true)
SetBlockingOfNonTemporaryEvents(npcHandle, true)
SetPedDiesWhenInjured(npcHandle, false)
SetPedCanPlayAmbientAnims(npcHandle, true)
SetPedCanRagdollFromPlayerImpact(npcHandle, false)
SetEntityInvincible(npcHandle, true)
FreezeEntityPosition(npcHandle, true) ]]
FreezeEntityPosition(npcHandle, true)
-- Optional: Animation für den NPC
TaskStartScenarioInPlace(npcHandle, "WORLD_HUMAN_GUARD_STAND", 0, true)