# Exports

## Interaction System Documentation

This script allows developers to add interaction options based on coordinates, entities, models, and vehicles in FiveM. Interactions are registered globally, locally, or to specific entities, peds, or vehicles, and they can also be removed dynamically.

***

### Functions

#### `addCoords`

Adds interaction options based on specific coordinates. If the coordinates are close to an already registered option, the new options are added to the existing interaction.

**Parameters:**

* **data**: A table containing the following:
  * `coords`: The vector coordinates where the interaction occurs.
  * `distance`: *(optional)* The maximum distance the interaction can be triggered (default: 2).
  * `options`: A table of interaction options.

**Usage:**

```
exports('addCoords', addCoords)
```

**Example:**

```
addCoords({ 
    coords = vector3(0, 0, 0), 
    distance = 5.0, 
    options = { 
        { 
            label = 'Interact', 
            onSelect = function() print('Hello World') end 
        } 
    } 
})
```

***

#### `addLocalEntity`

Adds interaction options for a local entity. The options are tied specifically to this entity.

**Parameters:**

* **data**: A table containing:
  * `entity`: The local entity (ID).
  * `distance`: *(optional)* The maximum distance the interaction can be triggered (default: 2).
  * `options`: A table of interaction options.

**Usage:**

```
exports('addLocalEntity', addLocalEntity)
```

**Example:**

```
addLocalEntity({ 
    entity = 12345, 
    distance = 3.0, 
    options = { 
        { 
            label = 'Inspect', 
            onSelect = function() print('Inspecting entity') end 
        } 
    } 
})
```

***

#### `addEntity`

Adds interaction options for a network entity. The interaction will be attached to the network ID of the entity.

**Parameters:**

* **data**: A table containing:
  * `netId`: The network ID of the entity.
  * `distance`: *(optional)* The maximum distance for interaction (default: 2).
  * `options`: A table of interaction options.

**Usage:**

```
exports('addEntity', addEntity)
```

**Example:**

```
addEntity({ 
    netId = 67890, 
    distance = 4.0, 
    options = { 
        { 
            label = 'Check', 
            onSelect = function() print('Checking entity') end 
        } 
    } 
})
```

***

#### `addGlobalPed`

Adds interaction options for global peds (pedestrian NPCs). These options will apply to any ped in the game within the specified distance.

**Parameters:**

* **data**: A table containing:
  * `distance`: *(optional)* The maximum distance for interaction (default: 3).
  * `options`: A table of interaction options.

**Usage:**

```
exports('addGlobalPed', addGlobalPed)
```

**Example:**

```
addGlobalPed({ 
    distance = 5.0, 
    options = { 
        { 
            label = 'Talk', 
            onSelect = function() print('Talking to ped') end 
        } 
    } 
})
```

***

#### `addGlobalVehicle`

Adds interaction options for vehicles. These interactions apply to all vehicles within the specified distance.

**Parameters:**

* **data**: A table containing:
  * `distance`: *(optional)* The maximum distance for interaction (default: 2).
  * `options`: A table of interaction options.

**Usage:**

```
exports('addGlobalVehicle', addGlobalVehicle)
```

**Example:**

```
addGlobalVehicle({ 
    distance = 3.0, 
    options = { 
        { 
            label = 'Enter Vehicle', 
            nSelect = function() print('Entering vehicle') end 
        } 
    } 
})
```

***

#### `addModel`

Adds interaction options for a specific model (e.g., a vehicle or object model). Any instance of this model within the specified distance can trigger the interaction.

**Parameters:**

* **data**: A table containing:
  * `model`: The model name.
  * `distance`: *(optional)* The maximum distance for interaction (default: 2).
  * `options`: A table of interaction options.

**Usage:**

```
exports('addModel', addModel)
```

**Example:**

```
addModel({ 
    model = 'elegy', 
    distance = 4.0, 
    options = { 
        { 
            label = 'Drive Car', 
            onSelect = function() print('Driving car') end 
        } 
    } 
})
```

***

#### `removeInteract`

Removes an interaction option based on its unique ID. This ID is generated when an interaction is added.

**Parameters:**

* **id**: The unique ID of the interaction to be removed.

**Usage:**

```
exports('removeInteract', removeInteract)
```

**Example:**

```
removeInteract(1)
```


---

# 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://docs.vildstore.com/interaction-menu/exports.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.
