forked from Simnation/Main
Update main.lua
This commit is contained in:
parent
9a36f57082
commit
13431ff326
1 changed files with 1 additions and 8 deletions
|
@ -18,34 +18,27 @@ function SpawnGuardNPC(npc)
|
||||||
local timeout = 0
|
local timeout = 0
|
||||||
while not HasModelLoaded(npc.model) and timeout < 100 do
|
while not HasModelLoaded(npc.model) and timeout < 100 do
|
||||||
timeout = timeout + 1
|
timeout = timeout + 1
|
||||||
print("Warte auf Model-Load...")
|
|
||||||
Wait(100)
|
Wait(100)
|
||||||
end
|
end
|
||||||
|
|
||||||
if not HasModelLoaded(npc.model) then
|
if not HasModelLoaded(npc.model) then
|
||||||
print("Model konnte nicht geladen werden!")
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
print("Model erfolgreich geladen, erstelle NPC...")
|
|
||||||
|
|
||||||
-- NPC erstellen
|
-- NPC erstellen
|
||||||
npcHandle = CreatePed(4, npc.model, npc.spawn.x, npc.spawn.y, npc.spawn.z, npc.spawn.w, false, true)
|
npcHandle = CreatePed(4, npc.model, npc.spawn.x, npc.spawn.y, npc.spawn.z, npc.spawn.w, false, true)
|
||||||
if not DoesEntityExist(npcHandle) then
|
if not DoesEntityExist(npcHandle) then
|
||||||
print("NPC konnte nicht erstellt werden!")
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
print("NPC erfolgreich erstellt mit Handle: " .. tostring(npcHandle))
|
|
||||||
-- NPC Eigenschaften setzen
|
-- NPC Eigenschaften setzen
|
||||||
SetEntityAsMissionEntity(npcHandle, true, true)
|
SetEntityAsMissionEntity(npcHandle, true, true)
|
||||||
SetPedDefaultComponentVariation(npcHandle)
|
|
||||||
--[[ SetEntityAsMissionEntity(npcHandle, true, true)
|
|
||||||
SetBlockingOfNonTemporaryEvents(npcHandle, true)
|
SetBlockingOfNonTemporaryEvents(npcHandle, true)
|
||||||
SetPedDiesWhenInjured(npcHandle, false)
|
SetPedDiesWhenInjured(npcHandle, false)
|
||||||
SetPedCanPlayAmbientAnims(npcHandle, true)
|
SetPedCanPlayAmbientAnims(npcHandle, true)
|
||||||
SetPedCanRagdollFromPlayerImpact(npcHandle, false)
|
SetPedCanRagdollFromPlayerImpact(npcHandle, false)
|
||||||
SetEntityInvincible(npcHandle, true)
|
SetEntityInvincible(npcHandle, true)
|
||||||
FreezeEntityPosition(npcHandle, true) ]]
|
FreezeEntityPosition(npcHandle, true)
|
||||||
|
|
||||||
-- Optional: Animation für den NPC
|
-- Optional: Animation für den NPC
|
||||||
TaskStartScenarioInPlace(npcHandle, "WORLD_HUMAN_GUARD_STAND", 0, true)
|
TaskStartScenarioInPlace(npcHandle, "WORLD_HUMAN_GUARD_STAND", 0, true)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue