Exports
License: LGPL-3.0 (GNU Lesser General Public License v3.0)
This resource is based on ox_target which is licensed under LGPL-3.0.
⚠️ This redesign is a paid product. Only verified purchasers are eligible for support and updates. Unverified users will not receive any assistance under any circumstances.
Overview
All exports are fully compatible with the original ox_target API. Existing scripts using exports['ox_target'] will work without modification.
Zone Exports
addBoxZone
Add a box-shaped target zone.
local id = exports.ox_target:addBoxZone({
coords = vec3(100.0, 200.0, 30.0),
size = vec3(2.0, 2.0, 2.0),
rotation = 0,
debug = false,
options = {
{
name = 'open_shop',
icon = 'fas fa-shopping-cart',
label = 'Open Shop',
onSelect = function()
print('Shop opened')
end,
canInteract = function(entity, distance, coords, name, bone)
return true
end,
},
},
})
addSphereZone
Add a sphere-shaped target zone.
local id = exports.ox_target:addSphereZone({
coords = vec3(100.0, 200.0, 30.0),
radius = 2.0,
debug = false,
options = { ... },
})
addPolyZone
Add a polygon-shaped target zone.
local id = exports.ox_target:addPolyZone({
points = {
vec3(100.0, 200.0, 30.0),
vec3(105.0, 200.0, 30.0),
vec3(105.0, 205.0, 30.0),
vec3(100.0, 205.0, 30.0),
},
thickness = 4.0,
debug = false,
options = { ... },
})
removeZone
Remove a previously added zone.
exports.ox_target:removeZone(id)
zoneExists
Check if a zone ID exists.
local exists = exports.ox_target:zoneExists(id) -- boolean
Global Entity Exports
addGlobalPed / removeGlobalPed
Add options to all peds.
local optionNames = exports.ox_target:addGlobalPed({
{
name = 'talk_to_ped',
icon = 'fas fa-comment',
label = 'Talk',
onSelect = function(data)
print('Talking to ped:', data.entity)
end,
},
})
exports.ox_target:removeGlobalPed(optionNames)
addGlobalVehicle / removeGlobalVehicle
Add options to all vehicles.
local optionNames = exports.ox_target:addGlobalVehicle({
{
name = 'check_vehicle',
icon = 'fas fa-car',
label = 'Check Vehicle',
onSelect = function(data)
print('Vehicle:', data.entity)
end,
},
})
exports.ox_target:removeGlobalVehicle(optionNames)
addGlobalObject / removeGlobalObject
Add options to all objects.
local optionNames = exports.ox_target:addGlobalObject({ ... })
exports.ox_target:removeGlobalObject(optionNames)
addGlobalPlayer / removeGlobalPlayer
Add options to all players.
local optionNames = exports.ox_target:addGlobalPlayer({
{
name = 'rob_player',
icon = 'fas fa-hand-holding-usd',
label = 'Rob',
onSelect = function(data)
print('Robbing player:', data.entity)
end,
},
})
exports.ox_target:removeGlobalPlayer(optionNames)
addGlobalOption / removeGlobalOption
Add options to ALL entity types (peds, vehicles, objects, players).
local optionNames = exports.ox_target:addGlobalOption({ ... })
exports.ox_target:removeGlobalOption(optionNames)
Model Exports
addModel / removeModel
Add options to specific model hashes.
local optionNames = exports.ox_target:addModel({'s_m_y_cop_01', 'csb_cop'}, {
{
name = 'police_interact',
icon = 'fas fa-shield-alt',
label = 'Talk to Officer',
onSelect = function(data)
print('Officer:', data.entity)
end,
},
})
exports.ox_target:removeModel({'s_m_y_cop_01', 'csb_cop'}, optionNames)
Entity Exports
addEntity / removeEntity
Add options to specific network entities (by network ID).
local optionNames = exports.ox_target:addEntity(netId, {
{
name = 'entity_action',
icon = 'fas fa-cog',
label = 'Interact',
onSelect = function(data) end,
},
})
exports.ox_target:removeEntity(netId, optionNames)
addLocalEntity / removeLocalEntity
Add options to local entities (by entity handle).
local optionNames = exports.ox_target:addLocalEntity(entityHandle, {
{
name = 'local_action',
icon = 'fas fa-cog',
label = 'Interact',
onSelect = function(data) end,
},
})
exports.ox_target:removeLocalEntity(entityHandle, optionNames)
Utility Exports
disableTargeting
Enable or disable targeting globally.
exports.ox_target:disableTargeting(true) -- Disable
exports.ox_target:disableTargeting(false) -- Enable
isActive
Check if targeting is currently active.
local active = exports.ox_target:isActive() -- boolean
getTargetOptions
Get target options for an entity.
local options = exports.ox_target:getTargetOptions(entity, type, model)
Option Properties
| Field | Type | Required | Description |
|---|---|---|---|
name |
string |
✅ | Unique option identifier |
icon |
string |
✅ | FontAwesome icon (fas fa-*) |
label |
string |
✅ | Display text |
onSelect |
function? |
— | Callback when selected |
canInteract |
function? |
— | Condition check (return boolean) |
distance |
number? |
— | Max interaction distance |
groups |
string or table? |
— | Required job/group |
items |
string or table? |
— | Required inventory items |
onSelect callback data
onSelect = function(data)
-- data.entity : entity handle
-- data.coords : interaction coordinates
-- data.name : option name
-- data.distance : distance to target
end
canInteract callback
canInteract = function(entity, distance, coords, name, bone)
return distance < 2.0 -- Only show if within 2 units
end
Examples
ATM Target
exports.ox_target:addModel({'prop_atm_01', 'prop_atm_02', 'prop_atm_03'}, {
{
name = 'use_atm',
icon = 'fas fa-credit-card',
label = 'Use ATM',
onSelect = function()
TriggerEvent('banking:openATM')
end,
distance = 1.5,
},
})
Job-restricted option
exports.ox_target:addGlobalPed({
{
name = 'arrest_ped',
icon = 'fas fa-handcuffs',
label = 'Arrest',
groups = 'police',
onSelect = function(data)
TriggerServerEvent('police:arrest', data.entity)
end,
},
})
Last updated: 2026-02-18