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)| Parameter | Type | Description |
|---|---|---|
| entity | number | Entity handle |
| options | table | Array of target option tables |
| distance | number | Interaction 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)| Parameter | Type | Description |
|---|---|---|
| name | string | Unique zone name |
| coords | vector3 | Zone center position |
| size | vector3 | Zone dimensions |
| heading | number | Zone heading/rotation |
| options | table | Array of target options |
| useZ | boolean | Use Z-axis for detection (optional) |
AddGlobalPlayer
Adds targeting options to all players.
Bridge.Target.AddGlobalPlayer(options)| Parameter | Type | Description |
|---|---|---|
| options | table | Array of target options |
AddGlobalVehicle
Adds targeting options to all vehicles.
Bridge.Target.AddGlobalVehicle(options)| Parameter | Type | Description |
|---|---|---|
| options | table | Array of target options |
AddModel
Adds targeting options to all entities of a specific model.
Bridge.Target.AddModel(model, options, distance)| Parameter | Type | Description |
|---|---|---|
| model | string | number | Model name or hash |
| options | table | Array of target options |
| distance | number | Interaction distance |
RemoveLocalEntity
Removes targeting from a specific entity.
Bridge.Target.RemoveLocalEntity(entity)| Parameter | Type | Description |
|---|---|---|
| entity | number | Entity handle |
RemoveZone
Removes a targeting zone by name.
Bridge.Target.RemoveZone(name)| Parameter | Type | Description |
|---|---|---|
| name | string | Zone name |
RemoveGlobalPlayer
Removes global player targeting options.
Bridge.Target.RemoveGlobalPlayer(labels)| Parameter | Type | Description |
|---|---|---|
| labels | table | Array of option labels to remove |
RemoveGlobalVehicle
Removes global vehicle targeting options.
Bridge.Target.RemoveGlobalVehicle(labels)| Parameter | Type | Description |
|---|---|---|
| labels | table | Array of option labels to remove |
RemoveModel
Removes targeting from a model.
Bridge.Target.RemoveModel(model, labels)| Parameter | Type | Description |
|---|---|---|
| model | string | number | Model name or hash |
| labels | table | Array of option labels to remove |