> ## 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

> Récupère la porte active la plus proche du joueur.

Retourne la porte **active** la plus proche du joueur.

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

### Valeur de retour

| Nom | Type de donnée | Description |
| - | - | - |
| `door` | table | Table contenant `door.id` et `door.object` |
| `distance` | float | Distance par rapport à la porte |

## Exemple

```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.