POS_actual = 1 PED_hasBeenTeleported = false function teleport(pos) local ped = GetPlayerPed(-1) Citizen.CreateThread(function() PED_hasBeenTeleported = true NetworkFadeOutEntity(ped, true, false) Citizen.Wait(500) SetEntityCoords(ped, pos.x, pos.y, pos.z, 1, 0, 0, 1) SetEntityHeading(ped, pos.h) NetworkFadeInEntity(ped, 0) Citizen.Wait(500) PED_hasBeenTeleported = false end) end Citizen.CreateThread(function() while true do Citizen.Wait(0) local ped = GetPlayerPed(-1) local playerPos = GetEntityCoords(ped, true) for i,pos in pairs(INTERIORS) do DrawMarker(1, pos.x, pos.y, pos.z-1, 0, 0, 0, 0, 0, 0, 1.0,1.0,0.5, 255,255,255, 200, 0, 0, 2, 0, 0, 0, 0) if (Vdist(playerPos.x, playerPos.y, playerPos.z, pos.x, pos.y, pos.z) < 1.0) and (not PED_hasBeenTeleported) then POS_actual = pos.id if not gui_interiors.opened then gui_interiors_OpenMenu() end end end end end)