# Get closest door

Returns the closest **active** door to the player

## Export

```lua
exports["doors_creator"]:getClosestActiveDoor()
```

### Return

| Name       | Data Type | Description                                      |
| ---------- | --------- | ------------------------------------------------ |
| `door`     | table     | Table containing the door.id and the door.object |
| `distance` | float     | Distance from the door                           |

## Example

```lua
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)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.jaksam-scripts.com/doors-creator/client/get-closest-door.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
