Logo

DIVERSITY

Documentation

Modules

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.

client.lua
local resourceName = dBridge.Interaction.GetResourceName()
Returned DataTypeDescription
resourceName
string
The name of the interaction resource (e.g., "ox_target").

DisableTargeting

Disables or enables the targeting system.

client.lua
dBridge.Interaction.DisableTargeting(true)
ArgumentTypeDescription
bool
boolean
True to disable, false to enable.

AddGlobalObject

Adds a target option to all objects.

client.lua
dBridge.Interaction.AddGlobalObject({
  {
    label = 'Interact',
    icon = 'fas fa-hand',
    onSelect = function() print('Interacted') end
  },
})
ArgumentTypeDescription
options
TargetOptions
The target options.

AddGlobalPed

Adds a target option to all peds.

client.lua
dBridge.Interaction.AddGlobalPed({
  {
    label = 'Talk',
    icon = 'fas fa-comments',
    onSelect = function() print('Talked') end      
  },
})
ArgumentTypeDescription
options
TargetOptions
The target options.

AddGlobalPlayer

Adds a target option to all players.

client.lua
dBridge.Interaction.AddGlobalPlayer({
  {
    label = 'Rob',
    icon = 'fas fa-mask',
    onSelect = function() print('Robbed') end
  },
})
ArgumentTypeDescription
options
TargetOptions
The target options.

AddGlobalVehicle

Adds a target option to all vehicles.

client.lua
dBridge.Interaction.AddGlobalVehicle({
  {
    label = 'Lockpick',
    icon = 'fas fa-lock-open',
    onSelect = function() print('Lockpicked') end
  },
})
ArgumentTypeDescription
options
TargetOptions
The target options.

AddModel

Adds a target option to specific models.

client.lua
dBridge.Interaction.AddModel('prop_vending_machine', {
  {
    label = 'Buy Soda',
    icon = 'fas fa-shopping-cart',
    onSelect = function() print('Bought Soda') end
  },
})
ArgumentTypeDescription
models
number | string | number[] | string[]
Model hash(es) or name(s).
options
TargetOptions
The target options.

AddLocalEntity

Adds a target option to specific entities.

client.lua
dBridge.Interaction.AddLocalEntity(entityId, {
  {
    label = 'Inspect',
    icon = 'fas fa-search',
    onSelect = function() print('Inspected') end
  },
})
ArgumentTypeDescription
entities
number | number[]
Entity handle(s).
options
TargetOptions
The target options.

AddSphereZone

Adds a sphere zone target.

client.lua
local zoneId = dBridge.Interaction.AddSphereZone('my_sphere', vec3(0, 0, 0), 2.0, {
  {
    label = 'Enter Sphere',
    onSelect = function() print('Entered') end
  },
}, false)
ArgumentTypeDescription
name
string
Unique name.
coords
vector3
Center coordinates.
radius
number
Radius.
options
TargetOptions
Target options.
debug?
boolean
Whether to show debug visualization (optional)
Returned DataTypeDescription
zoneId
string | number
Name or ID of the zone.

AddBoxZone

Adds a box zone target.

client.lua
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)
ArgumentTypeDescription
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 DataTypeDescription
zoneId
string | number
Name or ID of the zone.

AddPolyZone

Adds a poly zone target.

client.lua
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)
ArgumentTypeDescription
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 DataTypeDescription
zoneId
string | number
Name or ID of the zone.

RemoveGlobalObject

Removes a global object target option.

client.lua
dBridge.Interaction.RemoveGlobalObject('Interact')
ArgumentTypeDescription
optionNames
string | string[]
Name(s) of the options/labels to remove.

RemoveGlobalPed

Removes a global ped target option.

client.lua
dBridge.Interaction.RemoveGlobalPed('Talk')
ArgumentTypeDescription
optionNames
string | string[]
Name(s) of the options/labels to remove.

RemoveGlobalPlayer

Removes a global player target option.

client.lua
dBridge.Interaction.RemoveGlobalPlayer('Rob')
ArgumentTypeDescription
optionNames
string | string[]
Name(s) of the options/labels to remove.

RemoveGlobalVehicle

Removes a global vehicle target option.

client.lua
dBridge.Interaction.RemoveGlobalVehicle('Lockpick')
ArgumentTypeDescription
optionNames
string | string[]
Name(s) of the options/labels to remove.

RemoveModel

Removes a model target option.

client.lua
dBridge.Interaction.RemoveModel('prop_vending_machine', 'Buy Soda')
ArgumentTypeDescription
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.

client.lua
dBridge.Interaction.RemoveLocalEntity(entityId, 'Inspect')
ArgumentTypeDescription
entities
number | number[]
Entity handle(s).
optionNames
string | string[]
Name(s) of the options/labels to remove.

RemoveZone

Removes a zone by ID.

client.lua
dBridge.Interaction.RemoveZone(zoneId)
ArgumentTypeDescription
id
number | string
The zone ID.

TargetOptions Structure

ArgumentTypeDescription
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?