forked from Simnation/Main
Update main.lua
This commit is contained in:
parent
6fd16d35ce
commit
6ac3871e97
1 changed files with 2 additions and 6 deletions
|
@ -17,11 +17,12 @@ function SpawnGuardNPC(npc)
|
||||||
RequestModel(npc.model)
|
RequestModel(npc.model)
|
||||||
while not HasModelLoaded(npc.model) do
|
while not HasModelLoaded(npc.model) do
|
||||||
Wait(1)
|
Wait(1)
|
||||||
|
print("Model is Loading...")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- NPC erstellen
|
-- NPC erstellen
|
||||||
npcHandle = CreatePed(4, npc.model, npc.spawn.x, npc.spawn.y, npc.spawn.x, npc.spawn.w, false, true)
|
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
|
-- NPC Eigenschaften setzen
|
||||||
SetEntityAsMissionEntity(npcHandle, true, true)
|
SetEntityAsMissionEntity(npcHandle, true, true)
|
||||||
SetBlockingOfNonTemporaryEvents(npcHandle, true)
|
SetBlockingOfNonTemporaryEvents(npcHandle, true)
|
||||||
|
@ -54,15 +55,10 @@ CreateThread(function()
|
||||||
for k, v in pairs(Config.Zonen) do
|
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 dist = #(playerCoords - vector3(v.NPC.spawn.x, v.NPC.spawn.y, v.NPC.spawn.z))
|
||||||
local spawnDistance = v.NPC.distance
|
local spawnDistance = v.NPC.distance
|
||||||
print("PlayerCoords: "..playerCoords)
|
|
||||||
print("dist: "..dist)
|
|
||||||
print("spawnDistance: "..spawnDistance)
|
|
||||||
|
|
||||||
if dist < spawnDistance and not isNPCSpawned then
|
if dist < spawnDistance and not isNPCSpawned then
|
||||||
print("Trigger")
|
|
||||||
SpawnGuardNPC(v.NPC)
|
SpawnGuardNPC(v.NPC)
|
||||||
elseif dist > spawnDistance and isNPCSpawned then
|
elseif dist > spawnDistance and isNPCSpawned then
|
||||||
print("Distrigger")
|
|
||||||
RemoveGuardNPC()
|
RemoveGuardNPC()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue