Target

The Target module provides entity and zone targeting. Bridges ox_target, qb-target, and sleepless_interact.

Client Functions

AddLocalEntity

Adds targeting options to a specific entity.

Bridge.Target.AddLocalEntity(entity, options, distance)
ParameterTypeDescription
entitynumberEntity handle
optionstableArray of target option tables
distancenumberInteraction distance

Option Format

{
    label = 'Talk to NPC',
    icon = 'fa-solid fa-comments',
    onSelect = function(entity)
        print('Selected!')
    end,
    canInteract = function(entity)
        return true -- optional condition
    end
}

AddBoxZone

Creates a box zone with targeting options.

Bridge.Target.AddBoxZone(name, coords, size, heading, options, useZ)
ParameterTypeDescription
namestringUnique zone name
coordsvector3Zone center position
sizevector3Zone dimensions
headingnumberZone heading/rotation
optionstableArray of target options
useZbooleanUse Z-axis for detection (optional)

AddGlobalPlayer

Adds targeting options to all players.

Bridge.Target.AddGlobalPlayer(options)
ParameterTypeDescription
optionstableArray of target options

AddGlobalVehicle

Adds targeting options to all vehicles.

Bridge.Target.AddGlobalVehicle(options)
ParameterTypeDescription
optionstableArray of target options

AddModel

Adds targeting options to all entities of a specific model.

Bridge.Target.AddModel(model, options, distance)
ParameterTypeDescription
modelstring | numberModel name or hash
optionstableArray of target options
distancenumberInteraction distance

RemoveLocalEntity

Removes targeting from a specific entity.

Bridge.Target.RemoveLocalEntity(entity)
ParameterTypeDescription
entitynumberEntity handle

RemoveZone

Removes a targeting zone by name.

Bridge.Target.RemoveZone(name)
ParameterTypeDescription
namestringZone name

RemoveGlobalPlayer

Removes global player targeting options.

Bridge.Target.RemoveGlobalPlayer(labels)
ParameterTypeDescription
labelstableArray of option labels to remove

RemoveGlobalVehicle

Removes global vehicle targeting options.

Bridge.Target.RemoveGlobalVehicle(labels)
ParameterTypeDescription
labelstableArray of option labels to remove

RemoveModel

Removes targeting from a model.

Bridge.Target.RemoveModel(model, labels)
ParameterTypeDescription
modelstring | numberModel name or hash
labelstableArray of option labels to remove