From 6fcdf2d1d287da8918690a9a9c5e39ff77803168 Mon Sep 17 00:00:00 2001 From: Miho931 <98314142+Miho931@users.noreply.github.com> Date: Sun, 8 Jun 2025 13:44:19 +0200 Subject: [PATCH] =?UTF-8?q?[Garage]=20Print=C2=B4s=20add?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../[carscripts]/mh_garage/client/main.lua | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/resources/[carscripts]/mh_garage/client/main.lua b/resources/[carscripts]/mh_garage/client/main.lua index 882c12b83..eb694a99f 100644 --- a/resources/[carscripts]/mh_garage/client/main.lua +++ b/resources/[carscripts]/mh_garage/client/main.lua @@ -15,14 +15,27 @@ end) function SpawnGuardNPC(npc) -- Ped Model laden RequestModel(npc.model) - while not HasModelLoaded(npc.model) do - Wait(1) - print("Model is Loading...") + local timeout = 0 + while not HasModelLoaded(npcHash) and timeout < 100 do + timeout = timeout + 1 + print("Warte auf Model-Load...") + Wait(100) end + if not HasModelLoaded(npcHash) 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.x, npc.spawn.w, false, true) - print("NPC Sollte stehen!") + 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) SetBlockingOfNonTemporaryEvents(npcHandle, true)