2026-04-14 17:41:39 +02:00

43 lines
1.1 KiB
Lua

function TeleportToInterior(x, y, z, heading)
CreateThread(function()
SetEntityCoords(cache.ped, x, y, z, 0, 0, 0, false)
SetEntityHeading(cache.ped, heading)
Wait(100)
DoScreenFadeIn(1000)
end)
end
function CreateShell(shellCoords, interiorCoords, shellModel)
DoScreenFadeOut(500)
while not IsScreenFadedOut() do
Wait(10)
end
lib.requestModel(shellModel, 8000)
local shellObject = CreateObject(shellModel, shellCoords.x, shellCoords.y, shellCoords.z, false, false, false)
if shellCoords.h then
SetEntityHeading(shellObject, shellCoords.w)
end
SetModelAsNoLongerNeeded(shellModel)
FreezeEntityPosition(shellObject, true)
TeleportToInterior(interiorCoords.x, interiorCoords.y, interiorCoords.z, interiorCoords.w)
return shellObject
end
function DespawnInterior(shellObjects, callback)
CreateThread(function()
for _, shellObj in pairs(shellObjects) do
if shellObj and DoesEntityExist(shellObj) then
DeleteEntity(shellObj)
end
end
callback()
end)
end