> ## Documentation Index
> Fetch the complete documentation index at: https://docs.jaksam-scripts.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get closest door

> Obtén la puerta activa más cercana al jugador.

Devuelve la puerta **activa** más cercana al jugador.

```lua Export theme={null}
exports["doors_creator"]:getClosestActiveDoor()
```

### Valor de retorno

| Nombre | Tipo de dato | Descripción |
| - | - | - |
| `door` | table | Tabla que contiene `door.id` y `door.object` |
| `distance` | float | Distancia a la puerta |

## Ejemplo

```lua theme={null}
Citizen.CreateThread(function()
    local closestDoor, closestDist = exports["doors_creator"]:getClosestActiveDoor()

    if(closestDoor and closestDist < 3.0) then
        print("The closest door is " .. closestDoor.id .. " and is " .. closestDist .. " meters away")
    end
end)
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.