> For the complete documentation index, see [llms.txt](https://inside-scripts.gitbook.io/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://inside-scripts.gitbook.io/documentation/paid-scripts/interaction/functions.md).

# Functions

## <mark style="color:green;">Local Entity</mark>

The Interactions can only be invoked on the Client-Side!

### Adding Local Entity

{% tabs %}
{% tab title="Interaction" %}

```lua
exports["is_interaction"]:addInteractionLocalEntity(name, entity, data)
```

{% endtab %}

{% tab title="Text" %}

```lua
exports["is_interaction"]:addTextLocalEntity(name, entity, data)
```

{% endtab %}
{% endtabs %}

* name: `string`
* entity: `object`
* data: `table`
  * hideSquare: `boolean` or `nil`
  * checkVisibility: `boolean` or `nil`
  * showInVehicle: `boolean` or `nil`
  * distance: `number` or `nil`
  * distanceText: `number` or `nil`
  * offset: `table` or `nil`
    * text: `table`
      * x: `number`
      * y: `number`
      * z: `number`
    * target: `table`
      * x: `number`
      * y: `number`
      * z: `number`
  * bone: `number` or `string` or `nil`
  * options: `table`
    * option: `indexed table`
      * name: `string` or `nil`
      * label: `string` or `nil`
      * icon: `string` or `nil`
      * key: `string` or `nil`
      * duration: `number` or `nil`
      * onSelect: `function` or `nil`

#### Example Usage

```lua
-- Example 1: Using Interaction

exports["is_interaction"]:addInteractionLocalEntity("testInteraction", entity, {
    hideSquare = false,
    checkVisibility = true,
    showInVehicle = false,
    distance = 5.0,
    distanceText = 1.0,
    offset = {
        text = {x = 0.0, y = 0.0, z = 1.0},
        target = {x = 0.0, y = 0.0, z = 0.0}
    },
    bone = nil,
    options = {
        {
            name = "option1",
            label = "Example Text",
            icon = nil,
            key = "E",
            duration = 500,
            onSelect = function()
                print("option1 working")
            end
        },
    }
})

-- Example 2: Using Text

exports["is_interaction"]:addTextLocalEntity("testText", entity, {
    hideSquare = false,
    checkVisibility = true,
    showInVehicle = false,
    distance = 5.0,
    distanceText = 1.0,
    offset = {
        text = {x = 0.0, y = 0.0, z = 1.0},
        target = {x = 0.0, y = 0.0, z = 0.0}
    },
    bone = nil,
    options = {
        {
            name = "option1",
            label = "Example Text",
            icon = nil,
        },
    }
})
```

### Removing Local Entity

{% tabs %}
{% tab title="Remove" %}

```lua
exports["is_interaction"]:removeLocalEntity(entity, name, option)
```

{% endtab %}
{% endtabs %}

* entity: `object`
* name: `string` or `nil`
* option: `name` or `nil`

#### Example Usage

```lua
-- Example 1: Removing All Interactions

exports["is_interaction"]:removeLocalEntity(entity)

-- Example 2: Removing provided Interaction

exports["is_interaction"]:removeLocalEntity(entity, "testText")

-- Example 3: Removing provided Interaction Option

exports["is_interaction"]:removeLocalEntity(entity, "testText", "option1")
```

### Hiding/Showing Local Entity

{% tabs %}
{% tab title="Hiding" %}

```lua
exports["is_interaction"]:hideLocalEntity(entity, name)
```

{% endtab %}

{% tab title="Showing" %}

```lua
exports["is_interaction"]:showLocalEntity(entity, name)
```

{% endtab %}
{% endtabs %}

* entity: `object`
* name: `string` or `nil`

#### Example Usage

```lua
-- Example 1: Hiding All Interactions for specified Local Entity

exports["is_interaction"]:hideLocalEntity(entity)

-- Example 2: Hiding Interaction for specified Local Entity

exports["is_interaction"]:hideLocalEntity(entity, "testText")

-- Example 3: Showing All Interactions for specified Local Entity

exports["is_interaction"]:showLocalEntity(entity)

-- Example 4: Showing Interaction for specified Local Entity

exports["is_interaction"]:showLocalEntity(entity, "testText")
```

## <mark style="color:green;">Model</mark>

The Interactions can only be invoked on the Client-Side!

### Adding Model

{% tabs %}
{% tab title="Interaction" %}

```lua
exports["is_interaction"]:addInteractionModel(name, model, data)
```

{% endtab %}

{% tab title="Text" %}

```lua
exports["is_interaction"]:addTextModel(name, model, data)
```

{% endtab %}
{% endtabs %}

* name: `string`
* model: `hash`
* data: `table`
  * hideSquare: `boolean` or `nil`
  * checkVisibility: `boolean` or `nil`
  * showInVehicle: `boolean` or `nil`
  * distance: `number` or `nil`
  * distanceText: `number` or `nil`
  * offset: `table` or `nil`
    * text: `table`
      * x: `number`
      * y: `number`
      * z: `number`
    * target: `table`
      * x: `number`
      * y: `number`
      * z: `number`
  * bone: `number` or `string` or `nil`
  * options: `table`
    * option: `indexed table`
      * name: `string` or `nil`
      * label: `string` or `nil`
      * icon: `string` or `nil`
      * key: `string` or `nil`
      * duration: `number` or `nil`
      * onSelect: `function` or `nil`

#### Example Usage

```lua
-- Example 1: Using Interaction

exports["is_interaction"]:addInteractionModel("testInteraction", model, {
    hideSquare = false,
    checkVisibility = true,
    showInVehicle = false,
    distance = 5.0,
    distanceText = 1.0,
    offset = {
        text = {x = 0.0, y = 0.0, z = 1.0},
        target = {x = 0.0, y = 0.0, z = 0.0}
    },
    bone = nil,
    options = {
        {
            name = "option1",
            label = "Example Text",
            icon = nil,
            key = "E",
            duration = 500,
            onSelect = function(entity)
                print("found "..entity)
            end
        },
    }
})

-- Example 2: Using Text

exports["is_interaction"]:addTextModel("testText", model, {
    hideSquare = false,
    checkVisibility = true,
    showInVehicle = false,
    distance = 5.0,
    distanceText = 1.0,
    offset = {
        text = {x = 0.0, y = 0.0, z = 1.0},
        target = {x = 0.0, y = 0.0, z = 0.0}
    },
    bone = nil,
    options = {
        {
            name = "option1",
            label = "Example Text",
            icon = nil,
        },
    }
})
```

### Removing Model

{% tabs %}
{% tab title="Remove" %}

```lua
exports["is_interaction"]:removeModel(model, name, option)
```

{% endtab %}
{% endtabs %}

* model: `hash`
* name: `string` or `nil`
* option: `name` or `nil`

#### Example Usage

```lua
-- Example 1: Removing All Interactions

exports["is_interaction"]:removeModel(model)

-- Example 2: Removing provided Interaction

exports["is_interaction"]:removeModel(model, "testText")

-- Example 3: Removing provided Interaction Option

exports["is_interaction"]:removeModel(model, "testText", "option1")
```

### Hiding/Showing Model

{% tabs %}
{% tab title="Hiding" %}

```lua
exports["is_interaction"]:hideModel(model, name)
```

{% endtab %}

{% tab title="Showing" %}

```lua
exports["is_interaction"]:showModel(model, name)
```

{% endtab %}
{% endtabs %}

* model: `hash`
* name: `string` or `nil`

#### Example Usage

```lua
-- Example 1: Hiding All Interactions for specified Model

exports["is_interaction"]:hideModel(model)

-- Example 2: Hiding Interaction for specified Model

exports["is_interaction"]:hideModel(model, "testText")

-- Example 3: Showing All Interactions for specified Model

exports["is_interaction"]:showModel(model)

-- Example 4: Showing Interaction for specified Model

exports["is_interaction"]:showModel(model, "testText")
```

## <mark style="color:green;">Global Entities</mark>

The Interactions can only be invoked on the Client-Side!

### Adding Global Entities

{% tabs %}
{% tab title="Interaction" %}

```lua
exports["is_interaction"]:addInteractionGlobal(name, select, data)
```

{% endtab %}

{% tab title="Text" %}

```lua
exports["is_interaction"]:addTextGlobal(name, select, data)
```

{% endtab %}
{% endtabs %}

* name: `string`
* select: `"vehicle"` or `"ped"` or `"player"`
* data: `table`
  * hideSquare: `boolean` or `nil`
  * checkVisibility: `boolean` or `nil`
  * showInVehicle: `boolean` or `nil`
  * distance: `number` or `nil`
  * distanceText: `number` or `nil`
  * offset: `table` or `nil`
    * text: `table`
      * x: `number`
      * y: `number`
      * z: `number`
    * target: `table`
      * x: `number`
      * y: `number`
      * z: `number`
  * bone: `number` or `string` or `nil`
  * ignoreModel: `indexed table`
    * model: `hash`
  * options: `table`
    * option: `indexed table`
      * name: `string` or `nil`
      * label: `string` or `nil`
      * icon: `string` or `nil`
      * key: `string` or `nil`
      * duration: `number` or `nil`
      * onSelect: `function` or `nil`

**Example Usage**

```lua
-- Example 1: Using Interaction

exports["is_interaction"]:addInteractionGlobal("testInteraction", "vehicle", {
    hideSquare = false,
    checkVisibility = true,
    showInVehicle = false,
    distance = 5.0,
    distanceText = 1.0,
    offset = {
        text = {x = 0.0, y = 0.0, z = 1.0},
        target = {x = 0.0, y = 0.0, z = 0.0}
    },
    bone = nil,
    ignoreModel = {-295689028},
    options = {
        {
            name = "option1",
            label = "Example Text",
            icon = nil,
            key = "E",
            duration = 500,
            onSelect = function(entity)
                print("found "..entity)
            end
        },
    }
})

-- Example 2: Using Text

exports["is_interaction"]:addTextGlobal("testText", "vehicle", {
    hideSquare = false,
    checkVisibility = true,
    showInVehicle = false,
    distance = 5.0,
    distanceText = 1.0,
    offset = {
        text = {x = 0.0, y = 0.0, z = 1.0},
        target = {x = 0.0, y = 0.0, z = 0.0}
    },
    bone = nil,
    ignoreModel = {-295689028},
    options = {
        {
            name = "option1",
            label = "Example Text",
            icon = nil,
        },
    }
})
```

### Removing Global Entities

{% tabs %}
{% tab title="Remove" %}

```lua
exports["is_interaction"]:removeGlobal(select, name, option)
```

{% endtab %}
{% endtabs %}

* select: `"vehicle"` or `"ped"` or `"player"`
* name: `string` or `nil`
* option: `name` or `nil`

**Example Usage**

```lua
-- Example 1: Removing All Interactions

exports["is_interaction"]:removeGlobal(select)

-- Example 2: Removing provided Interaction

exports["is_interaction"]:removeGlobal(select, "testText")

-- Example 3: Removing provided Interaction Option

exports["is_interaction"]:removeGlobal(select, "testText", "option1")
```

### Hiding/Showing Global Entities

{% tabs %}
{% tab title="Hiding" %}

```lua
exports["is_interaction"]:hideGlobal(select, name)
```

{% endtab %}

{% tab title="Showing" %}

```lua
exports["is_interaction"]:showGlobal(select, name)
```

{% endtab %}
{% endtabs %}

* select: `"vehicle"` or `"ped"` or `"player"`
* name: `string` or `nil`

#### Example Usage

```lua
-- Example 1: Hiding All Interactions for specified Global Entities

exports["is_interaction"]:hideGlobal(select)

-- Example 2: Hiding Interaction for specified Global Entities

exports["is_interaction"]:hideGlobal(select, "testText")

-- Example 3: Showing All Interactions for specified Global Entities

exports["is_interaction"]:showGlobal(select)

-- Example 4: Showing Interaction for specified Global Entities

exports["is_interaction"]:showGlobal(select, "testText")
```

## <mark style="color:green;">Coordinates</mark>

The Interactions can only be invoked on the Client-Side!

### Adding Coordinates

{% tabs %}
{% tab title="Interaction" %}

```lua
exports["is_interaction"]:addInteractionCoords(name, coords, data)
```

{% endtab %}

{% tab title="Text" %}

```lua
exports["is_interaction"]:addTextCoords(name, coords, data)
```

{% endtab %}
{% endtabs %}

* name: `string`
* coords: `vector3`
* data: `table`
  * hideSquare: `boolean` or `nil`
  * checkVisibility: `boolean` or `nil`
  * showInVehicle: `boolean` or `nil`
  * distance: `number` or `nil`
  * distanceText: `number` or `nil`
  * offset: `table` or `nil`
    * text: `table`
      * x: `number`
      * y: `number`
      * z: `number`
    * target: `table`
      * x: `number`
      * y: `number`
      * z: `number`
  * options: `table`
    * option: `indexed table`
      * name: `string` or `nil`
      * label: `string` or `nil`
      * icon: `string` or `nil`
      * key: `string` or `nil`
      * duration: `number` or `nil`
      * onSelect: `function` or `nil`

#### Example Usage

<pre class="language-lua"><code class="lang-lua">-- Example 1: Using Interaction

exports["is_interaction"]:addInteractionCoords("testInteraction", coords, {
<strong>    hideSquare = false,
</strong>    checkVisibility = true,
    showInVehicle = false,
    distance = 5.0,
    distanceText = 1.0,
    offset = {
        text = {x = 0.0, y = 0.0, z = 1.0},
        target = {x = 0.0, y = 0.0, z = 0.0}
    },
    options = {
        {
            name = "option1",
            label = "Example Text",
            icon = nil,
            key = "E",
            duration = 500,
            onSelect = function()
                print("option1 working")
            end
        },
    }
})

-- Example 2: Using Text

exports["is_interaction"]:addTextCoords("testText", coords, {
    hideSquare = false,
    checkVisibility = true,
    showInVehicle = false,
    distance = 5.0,
    distanceText = 1.0,
    offset = {
        text = {x = 0.0, y = 0.0, z = 1.0},
        target = {x = 0.0, y = 0.0, z = 0.0}
    },
    options = {
        {
            name = "option1",
            label = "Example Text",
            icon = nil,
        },
    }
})
</code></pre>

### Removing Coordinates

{% tabs %}
{% tab title="Remove" %}

```lua
exports["is_interaction"]:removeCoords(coords, name, option)
```

{% endtab %}
{% endtabs %}

* coords: `vector3`
* name: `string` or `nil`
* option: `name` or `nil`

#### Example Usage

```lua
-- Example 1: Removing All Interactions

exports["is_interaction"]:removeCoords(coords)

-- Example 2: Removing provided Interaction

exports["is_interaction"]:removeCoords(coords, "testText")

-- Example 3: Removing provided Interaction Option

exports["is_interaction"]:removeCoords(coords, "testText", "option1")
```

### Hiding/Showing Coordinates

{% tabs %}
{% tab title="Hiding" %}

```lua
exports["is_interaction"]:hideCoords(coords, name)
```

{% endtab %}

{% tab title="Showing" %}

```lua
exports["is_interaction"]:showCoords(coords, name)
```

{% endtab %}
{% endtabs %}

* coords: vector3
* name: `string` or `nil`

#### Example Usage

```lua
-- Example 1: Hiding All Interactions at specified Coordinates

exports["is_interaction"]:hideCoords(coords)

-- Example 2: Hiding Interaction at specified Coordinates

exports["is_interaction"]:hideCoords(coords, "testText")

-- Example 3: Showing All Interactions at specified Coordinates

exports["is_interaction"]:showCoords(coords)

-- Example 4: Showing Interaction at specified Coordinates

exports["is_interaction"]:showCoords(coords, "testText")
```

## <mark style="color:green;">Misc</mark>

The Interactions can only be invoked on the Client-Side!

### Removing Interactions Created By Resource

{% tabs %}
{% tab title="Remove" %}

```lua
exports["is_interaction"]:removeResource(resource)
```

{% endtab %}
{% endtabs %}

* resource: `string` or `nil`

#### Example Usage

```lua
-- Example 1: Removing Interactions in specified resource

exports["is_interaction"]:removeResource("qb-shops")

-- Example 2: Removing Interactions in current resource

exports["is_interaction"]:removeResource()
```
