Interaction
The Intraction module provides a unified interface for adding interactive targets to players, vehicles, entities, and zones.
Client Functions
GetResourceName
Returns the name of the underlying interaction resource being used.
local resourceName = dBridge.Interaction.GetResourceName()| Returned Data | Type | Description |
|---|---|---|
resourceName | string | The name of the interaction resource (e.g., "ox_target"). |
DisableTargeting
Disables or enables the targeting system.
dBridge.Interaction.DisableTargeting(true)| Argument | Type | Description |
|---|---|---|
bool | boolean | True to disable, false to enable. |
AddGlobalObject
Adds a target option to all objects.
dBridge.Interaction.AddGlobalObject({
{
label = 'Interact',
icon = 'fas fa-hand',
onSelect = function() print('Interacted') end
},
})| Argument | Type | Description |
|---|---|---|
options | TargetOptions | The target options. |
AddGlobalPed
Adds a target option to all peds.
dBridge.Interaction.AddGlobalPed({
{
label = 'Talk',
icon = 'fas fa-comments',
onSelect = function() print('Talked') end
},
})| Argument | Type | Description |
|---|---|---|
options | TargetOptions | The target options. |
AddGlobalPlayer
Adds a target option to all players.
dBridge.Interaction.AddGlobalPlayer({
{
label = 'Rob',
icon = 'fas fa-mask',
onSelect = function() print('Robbed') end
},
})| Argument | Type | Description |
|---|---|---|
options | TargetOptions | The target options. |
AddGlobalVehicle
Adds a target option to all vehicles.
dBridge.Interaction.AddGlobalVehicle({
{
label = 'Lockpick',
icon = 'fas fa-lock-open',
onSelect = function() print('Lockpicked') end
},
})| Argument | Type | Description |
|---|---|---|
options | TargetOptions | The target options. |
AddModel
Adds a target option to specific models.
dBridge.Interaction.AddModel('prop_vending_machine', {
{
label = 'Buy Soda',
icon = 'fas fa-shopping-cart',
onSelect = function() print('Bought Soda') end
},
})| Argument | Type | Description |
|---|---|---|
models | number | string | number[] | string[] | Model hash(es) or name(s). |
options | TargetOptions | The target options. |
AddLocalEntity
Adds a target option to specific entities.
dBridge.Interaction.AddLocalEntity(entityId, {
{
label = 'Inspect',
icon = 'fas fa-search',
onSelect = function() print('Inspected') end
},
})| Argument | Type | Description |
|---|---|---|
entities | number | number[] | Entity handle(s). |
options | TargetOptions | The target options. |
AddSphereZone
Adds a sphere zone target.
local zoneId = dBridge.Interaction.AddSphereZone('my_sphere', vec3(0, 0, 0), 2.0, {
{
label = 'Enter Sphere',
onSelect = function() print('Entered') end
},
}, false)| Argument | Type | Description |
|---|---|---|
name | string | Unique name. |
coords | vector3 | Center coordinates. |
radius | number | Radius. |
options | TargetOptions | Target options. |
debug? | boolean | Whether to show debug visualization (optional) |
| Returned Data | Type | Description |
|---|---|---|
zoneId | string | number | Name or ID of the zone. |
AddBoxZone
Adds a box zone target.
local zoneId = dBridge.Interaction.AddBoxZone('my_zone', vec3(0, 0, 0), vec3(2, 2, 2), 0, {
{
label = 'Enter Zone',
onSelect = function() print('Entered') end
},
}, false)| Argument | Type | Description |
|---|---|---|
name | string | Unique name. |
coords | vector3 | Center coordinates. |
size | vector3 | Size of the box. |
rotation | number | Rotation (may not apply to all systems). |
options | TargetOptions | Target options. |
debug? | boolean | Whether to show debug visualization (optional) |
| Returned Data | Type | Description |
|---|---|---|
zoneId | string | number | Name or ID of the zone. |
AddPolyZone
Adds a poly zone target.
local zoneId = dBridge.Interaction.AddPolyZone('my_poly', {vec3(0,0,0), vec3(1,0,0)}, 2.0, {
{
label = 'Enter Poly',
onSelect = function() print('Entered') end
},
}, false)| Argument | Type | Description |
|---|---|---|
name | string | Unique name. |
points | vector3[] | vector2[] | Polygon points. |
thickness | number | Thickness (may not apply to all systems). |
options | TargetOptions | Target options. |
debug? | boolean | Whether to show debug visualization (optional) |
| Returned Data | Type | Description |
|---|---|---|
zoneId | string | number | Name or ID of the zone. |
RemoveGlobalObject
Removes a global object target option.
dBridge.Interaction.RemoveGlobalObject('Interact')| Argument | Type | Description |
|---|---|---|
optionNames | string | string[] | Name(s) of the options/labels to remove. |
RemoveGlobalPed
Removes a global ped target option.
dBridge.Interaction.RemoveGlobalPed('Talk')| Argument | Type | Description |
|---|---|---|
optionNames | string | string[] | Name(s) of the options/labels to remove. |
RemoveGlobalPlayer
Removes a global player target option.
dBridge.Interaction.RemoveGlobalPlayer('Rob')| Argument | Type | Description |
|---|---|---|
optionNames | string | string[] | Name(s) of the options/labels to remove. |
RemoveGlobalVehicle
Removes a global vehicle target option.
dBridge.Interaction.RemoveGlobalVehicle('Lockpick')| Argument | Type | Description |
|---|---|---|
optionNames | string | string[] | Name(s) of the options/labels to remove. |
RemoveModel
Removes a model target option.
dBridge.Interaction.RemoveModel('prop_vending_machine', 'Buy Soda')| Argument | Type | Description |
|---|---|---|
models | number | string | number[] | string[] | Model hash(es) or name(s). |
optionNames | string | string[] | Name(s) of the options/labels to remove. |
RemoveLocalEntity
Removes a target option from specific entities.
dBridge.Interaction.RemoveLocalEntity(entityId, 'Inspect')| Argument | Type | Description |
|---|---|---|
entities | number | number[] | Entity handle(s). |
optionNames | string | string[] | Name(s) of the options/labels to remove. |
RemoveZone
Removes a zone by ID.
dBridge.Interaction.RemoveZone(zoneId)| Argument | Type | Description |
|---|---|---|
id | number | string | The zone ID. |
TargetOptions Structure
| Argument | Type | Description |
|---|---|---|
label | string | Label to display. |
name? | string | Unique name for the option. |
icon? | string | FontAwesome icon class. |
iconColor? | string | Color of the icon. |
distance? | number | Interaction distance. |
bones? | string | string[] | Bone(s) to attach to. |
offset? | vector3 | Offset from entity/bone. |
groups? | string | string[] | table<string, number> | Required job/gang/group. |
items? | string | string[] | table<string, number> | Required item(s). |
canInteract? | function | Function returning boolean. |
onSelect? | function | Function called on selection. |
event? | string | Client event to trigger. |
serverEvent? | string | Server event to trigger. |
command? | string | Command to execute. |
Was this page helpful?
Framework
Universal framework compatibility layer that provides consistent access to player data, jobs, and framework-specific functions across various frameworks. This is the foundation module that enables cross-framework development.
Inventory
The Inventory module provides a unified interface for handling player inventory items across different inventory systems.