> For the complete documentation index, see [llms.txt](https://brunx-mods.gitbook.io/brunx-mods-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://brunx-mods.gitbook.io/brunx-mods-docs/products/scripts/brunx-bridge/target-integration.md).

# Target Integration

`Bridge.Target` gives you one way to add interactions. The bridge sends them to ox\_target or qb-target, or shows an `[E]` prompt when neither is installed.

## Options

Options use the ox\_target format. The bridge converts them for qb-target.

| Field         | Type               | Description                                                        |
| ------------- | ------------------ | ------------------------------------------------------------------ |
| `label`       | `string`           | Text in the menu or prompt                                         |
| `name`        | `string?`          | Unique option name, defaults to the label                          |
| `icon`        | `string?`          | Font Awesome icon, for example `'fa-solid fa-door-open'`           |
| `distance`    | `number?`          | Interaction distance                                               |
| `groups`      | `table?`           | Jobs that see the option, for example `{ police = 0 }`             |
| `items`       | `string \| table?` | Required item(s)                                                   |
| `canInteract` | `function?`        | `function(entity, distance, coords, name)`, return `false` to hide |
| `onSelect`    | `function?`        | Runs when the option is chosen                                     |
| `event`       | `string?`          | Client event to trigger instead of `onSelect`                      |
| `serverEvent` | `string?`          | Server event to trigger instead of `onSelect`                      |
| `args`        | `any?`             | Passed to `onSelect` (as `data.args`) or to the event              |

## Zones

{% tabs %}
{% tab title="Box zone" %}

```lua
Bridge.Target.AddBoxZone('mrpd_armory', {
    coords = vec3(452.3, -980.0, 30.7),
    size = vec3(1.5, 1.5, 2.0),   -- or length / width / minZ / maxZ
    rotation = 90.0,
    debug = false,
    options = {
        {
            label = 'Open armory',
            icon = 'fa-solid fa-gun',
            groups = { police = 0 },
            onSelect = function()
                TriggerServerEvent('mrpd:openArmory')
            end
        }
    }
})
```

{% endtab %}

{% tab title="Sphere zone" %}

```lua
Bridge.Target.AddSphereZone('bench_repair', {
    coords = vec3(-339.4, -136.8, 39.0),
    radius = 1.5,
    options = {
        { label = 'Repair', icon = 'fa-solid fa-wrench', event = 'mechanic:repair' }
    }
})
```

{% endtab %}

{% tab title="Remove" %}

```lua
Bridge.Target.RemoveZone('mrpd_armory')
```

{% endtab %}
{% endtabs %}

Adding a zone with an existing id replaces the old zone.

## Entities and models

```lua
Bridge.Target.AddEntity(ped, {
    { label = 'Talk', icon = 'fa-solid fa-comment', onSelect = function() StartTalk(ped) end }
})

Bridge.Target.AddModel({ `prop_atm_01`, `prop_atm_02` }, {
    { label = 'Use ATM', icon = 'fa-solid fa-credit-card', event = 'bank:openAtm' }
})

Bridge.Target.RemoveEntity(ped)
Bridge.Target.RemoveModel({ `prop_atm_01`, `prop_atm_02` })
```

## All functions

| Function                        | Returns   |
| ------------------------------- | --------- |
| `AddBoxZone(id, data)`          | `boolean` |
| `AddSphereZone(id, data)`       | `boolean` |
| `RemoveZone(id)`                | `boolean` |
| `AddEntity(entity, options)`    | `boolean` |
| `RemoveEntity(entity, labels?)` | `boolean` |
| `AddModel(models, options)`     | `boolean` |
| `RemoveModel(models, labels?)`  | `boolean` |
| `DrawText({ text, icon? })`     | `boolean` |
| `HideDrawText()`                | `boolean` |
| `GetSystem()`                   | `string`  |

## Drawtext fallback

Without ox\_target or qb-target, box and sphere zones still work: within range the player sees an ox\_lib text prompt with the first option they can use, and presses **E** to select it. Style and key are set in `Config.DrawText`.

{% hint style="warning" %}
`AddEntity` and `AddModel` need a target resource. With the fallback they return `false`.
{% endhint %}

`DrawText` and `HideDrawText` show and hide your own prompt, separate from the zones.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://brunx-mods.gitbook.io/brunx-mods-docs/products/scripts/brunx-bridge/target-integration.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
