Exports & API
Core Focus exposes a comprehensive export API that mirrors qb-target and ox_target syntax. These are the native core_focus exports — the bridge layer also provides full qb-target, ox_target, and qtarget compatibility automatically.
Unique Parameters
Core Focus adds two unique parameters that can be used alongside the standard options in any export:
| Parameter | Type | Description |
|---|---|---|
forceColor | string (hex) | Forces the targeting dot and radial menu to use this specific color |
forceSeperate | boolean | Forces these options into a separate dot instead of merging with existing options |
lua
exports['core_focus']:AddTargetModel(models, {
options = { ... },
distance = 3.0,
forceColor = "#ff0000", -- Red dot
forceSeperate = true -- Own dot, won't merge
})Zone Exports
client
exports['core_focus']:AddBoxZone(name, coords, length, width, options, targetOptions)Creates a box-shaped targeting zone at the specified coordinates.
| Parameter | Type | Description |
|---|---|---|
name | string | Unique zone identifier |
coords | vector3 | Center position |
length | number | Zone length |
width | number | Zone width |
options | table | PolyZone options (heading, minZ, maxZ, debugPoly) |
targetOptions | table | Target options table with options array and distance |
Returns:
zoneExample
lua
exports['core_focus']:AddBoxZone("bank_vault", vector3(255.0, 220.0, 101.0), 2.0, 2.0, {
heading = 70.0,
minZ = 100.0,
maxZ = 103.0,
}, {
options = {
{
label = "Open Vault",
icon = "fas fa-vault",
job = "police",
action = function()
TriggerEvent('bank:openVault')
end
}
},
distance = 2.5,
forceColor = "#FFD700"
})client
exports['core_focus']:AddCircleZone(name, coords, radius, options, targetOptions)Creates a circular targeting zone.
| Parameter | Type | Description |
|---|---|---|
name | string | Unique zone identifier |
coords | vector3 | Center position |
radius | number | Zone radius |
options | table | PolyZone options |
targetOptions | table | Target options table |
Returns:
zoneExample
lua
exports['core_focus']:AddCircleZone("shop_counter", vector3(25.0, -1347.0, 29.0), 1.5, {
useZ = true,
}, {
options = {
{ label = "Open Shop", icon = "fas fa-store", action = function()
TriggerEvent('shop:open')
end }
},
distance = 2.0
})client
exports['core_focus']:AddSphereZone(name, coords, radius, options, targetOptions)Creates a sphere-shaped targeting zone (3D radius check).
| Parameter | Type | Description |
|---|---|---|
name | string | Unique zone identifier |
coords | vector3 | Center position |
radius | number | Sphere radius |
options | table | PolyZone options |
targetOptions | table | Target options table |
Returns:
zoneExample
lua
exports['core_focus']:AddSphereZone("atm_zone", vector3(149.5, -1040.9, 29.4), 1.0, {}, {
options = {
{ label = "Use ATM", icon = "fas fa-credit-card", action = function()
TriggerEvent('atm:open')
end }
},
distance = 2.0
})client
exports['core_focus']:AddPolyZone(name, points, options, targetOptions)Creates a polygon-shaped targeting zone from an array of points.
| Parameter | Type | Description |
|---|---|---|
name | string | Unique zone identifier |
points | vector3[] | Array of polygon corner points |
options | table | PolyZone options |
targetOptions | table | Target options table |
Returns:
zoneExample
lua
exports['core_focus']:AddPolyZone("garage_area", {
vector3(215.0, -810.0, 30.0),
vector3(230.0, -810.0, 30.0),
vector3(230.0, -825.0, 30.0),
vector3(215.0, -825.0, 30.0),
}, { minZ = 29.0, maxZ = 33.0 }, {
options = {
{ label = "Access Garage", icon = "fas fa-warehouse", action = function()
TriggerEvent('garage:open')
end }
},
distance = 3.0
})client
exports['core_focus']:AddEntityZone(name, entity, options, targetOptions)Creates a targeting zone attached to a specific entity.
| Parameter | Type | Description |
|---|---|---|
name | string | Unique zone identifier |
entity | entity | Entity handle |
options | table | PolyZone options |
targetOptions | table | Target options table |
Returns:
zoneExample
lua
local ped = CreatePed(...)
exports['core_focus']:AddEntityZone("vendor_ped", ped, {}, {
options = {
{ label = "Talk to Vendor", icon = "fas fa-comments", action = function()
TriggerEvent('vendor:interact')
end }
},
distance = 2.0,
forceColor = "#4ade80"
})client
exports['core_focus']:RemoveZone(name)Removes a previously created targeting zone by name.
| Parameter | Type | Description |
|---|---|---|
name | string | Zone identifier to remove |
Example
lua
exports['core_focus']:RemoveZone("bank_vault")Entity & Model Exports
client
exports['core_focus']:AddTargetEntity(entities, params)Adds targeting options to specific entity handles.
| Parameter | Type | Description |
|---|---|---|
entities | entity | entity[] | Single entity or array of entities |
params | table | Options table with options array, distance, forceColor, forceSeperate |
Example
lua
exports['core_focus']:AddTargetEntity(myPed, {
options = {
{ label = "Interact", icon = "fas fa-hand", action = function(entity)
-- do something with entity
end }
},
distance = 2.5
})client
exports['core_focus']:RemoveTargetEntity(entities, labels)Removes specific options from entities by label.
| Parameter | Type | Description |
|---|---|---|
entities | entity | entity[] | Entity or array of entities |
labels | string[] | Array of option labels to remove |
Example
lua
exports['core_focus']:RemoveTargetEntity(myPed, { "Interact" })client
exports['core_focus']:AddTargetModel(models, params)Adds targeting options to all entities matching the given model hash(es).
| Parameter | Type | Description |
|---|---|---|
models | hash | hash[] | Model hash or array of hashes |
params | table | Options table with options array, distance, forceColor, forceSeperate |
Example
lua
exports['core_focus']:AddTargetModel({ `prop_atm_01`, `prop_atm_02` }, {
options = {
{ label = "Use ATM", icon = "fas fa-money-check", action = function()
TriggerEvent('atm:open')
end }
},
distance = 1.5,
forceColor = "#03d5ff"
})client
exports['core_focus']:RemoveTargetModel(models, labels)Removes specific options from model targets by label.
| Parameter | Type | Description |
|---|---|---|
models | hash | hash[] | Model hash or array of hashes |
labels | string[] | Array of option labels to remove |
Example
lua
exports['core_focus']:RemoveTargetModel({ `prop_atm_01` }, { "Use ATM" })Bone Exports
client
exports['core_focus']:AddTargetBone(bones, params)Adds targeting options to specific vehicle or ped bones. Useful for precise interactions like vehicle doors, wheels, or ped body parts.
| Parameter | Type | Description |
|---|---|---|
bones | string | string[] | Bone name(s) — e.g. boot, bonnet, door_dside_f, SKEL_Head |
params | table | Options table with options array, distance, forceColor, forceSeperate |
Example
lua
exports['core_focus']:AddTargetBone("boot", {
options = {
{ label = "Open Trunk", icon = "fas fa-box-open", action = function(entity)
-- open trunk logic
end }
},
distance = 2.0,
forceColor = "#42f554"
})client
exports['core_focus']:RemoveTargetBone(bones, labels)Removes specific options from bone targets by label.
| Parameter | Type | Description |
|---|---|---|
bones | string | string[] | Bone name(s) to remove from |
labels | string[] | Array of option labels to remove |
Example
lua
exports['core_focus']:RemoveTargetBone("boot", { "Open Trunk" })Supported Vehicle Bones:
| Category | Bones |
|---|---|
| Body | chassis, bodyshell, bonnet, boot |
| Doors | door_dside_f, door_dside_r, door_pside_f, door_pside_r |
| Windows | windscreen, window_lf, window_lr, window_rf, window_rr |
| Wheels | wheel_lf, wheel_lr, wheel_rf, wheel_rr |
| Seats | seat_dside_f, seat_dside_r, seat_pside_f, seat_pside_r |
| Other | engine, exhaust |
Supported Ped Bones:SKEL_Head, SKEL_Neck_1, SKEL_Pelvis, SKEL_L_Hand, SKEL_R_Hand, SKEL_L_Foot, SKEL_R_Foot
Global Exports
client
exports['core_focus']:AddGlobalPed(params)Adds targeting options to ALL peds in the world.
| Parameter | Type | Description |
|---|---|---|
params | table | Options table with options array, distance, forceColor |
Example
lua
exports['core_focus']:AddGlobalPed({
options = {
{ label = "Identify", icon = "fas fa-magnifying-glass", action = function(entity)
-- identify ped
end }
},
distance = 3.0
})client
exports['core_focus']:AddGlobalVehicle(params)Adds targeting options to ALL vehicles in the world.
| Parameter | Type | Description |
|---|---|---|
params | table | Options table |
Example
lua
exports['core_focus']:AddGlobalVehicle({
options = {
{ label = "Check Plate", icon = "fas fa-rectangle-list", action = function(entity)
local plate = GetVehicleNumberPlateText(entity)
print("Plate: " .. plate)
end }
},
distance = 4.0
})client
exports['core_focus']:AddGlobalObject(params)Adds targeting options to ALL objects in the world.
| Parameter | Type | Description |
|---|---|---|
params | table | Options table |
Example
lua
exports['core_focus']:AddGlobalObject({
options = {
{ label = "Inspect", icon = "fas fa-eye", action = function(entity) end }
},
distance = 2.0
})client
exports['core_focus']:AddGlobalPlayer(params)Adds targeting options to ALL player peds.
| Parameter | Type | Description |
|---|---|---|
params | table | Options table |
Example
lua
exports['core_focus']:AddGlobalPlayer({
options = {
{ label = "Trade", icon = "fas fa-handshake", action = function(entity)
TriggerEvent('trade:open', GetPlayerServerId(NetworkGetPlayerIndexFromPed(entity)))
end }
},
distance = 3.0
})Remove global targets with: RemoveGlobalPed(labels), RemoveGlobalVehicle(labels), RemoveGlobalObject(labels), RemoveGlobalPlayer(labels)
Utility Exports
client
exports['core_focus']:AllowTargeting(state)Enables or disables the entire targeting system.
| Parameter | Type | Description |
|---|---|---|
state | boolean | true to enable, false to disable |
Example
lua
-- Disable targeting during a cutscene
exports['core_focus']:AllowTargeting(false)
-- Re-enable after
exports['core_focus']:AllowTargeting(true)client
exports['core_focus']:IsTargetActive()Returns whether the targeting menu is currently open.
Returns:
booleanExample
lua
if exports['core_focus']:IsTargetActive() then
print('Player is targeting')
endclient
exports['core_focus']:DisableTarget(force)Force closes the radial targeting menu.
| Parameter | Type | Description |
|---|---|---|
force | boolean | Force close immediately |
Example
lua
exports['core_focus']:DisableTarget(true)client
exports['core_focus']:RaycastCamera(flag, playerCoords)Casts a ray from the camera forward. Useful for custom targeting logic.
| Parameter | Type | Description |
|---|---|---|
flag | number | Raycast flags (entity types to detect) |
playerCoords | vector3 | Optional player position override |
Returns:
endCoords, distance, entityHit, entityTypeExample
lua
local endCoords, dist, entity, entityType = exports['core_focus']:RaycastCamera(30)
if entity ~= 0 then
print('Hit entity at distance:', dist)
endclient
exports['core_focus']:SpawnPed(data)Spawns an NPC ped with targeting options attached.
| Parameter | Type | Description |
|---|---|---|
data | table | Ped spawn data (model, coords, heading, options) |
Example
lua
exports['core_focus']:SpawnPed({
model = 's_m_y_dealer_01',
coords = vector3(100.0, -200.0, 30.0),
heading = 180.0,
options = {
{ label = "Buy Supplies", icon = "fas fa-shopping-bag", action = function() end }
},
distance = 2.0
})Augmented Reality Exports
client
exports['core_focus']:AddAugmentedLocation(name, coords, height, color, distance, ground)Adds a new AR border to the world at runtime.
| Parameter | Type | Description |
|---|---|---|
name | string | Display name |
coords | vector3[] | Corner points |
height | number | Border height |
color | string | Hex color |
distance | number | Render distance |
ground | string|number | Ground level |
Example
lua
exports['core_focus']:AddAugmentedLocation("MY ZONE", {
vector3(100.0, 200.0, 30.0),
vector3(110.0, 200.0, 30.0),
vector3(110.0, 210.0, 30.0),
vector3(100.0, 210.0, 30.0),
}, 5.0, "#FF00FF", 100.0, 'auto')client
exports['core_focus']:AddAugmentedWindowCoords(title, coords, length, height, color, style, data, distance, heading)Adds a floating AR information window at coordinates.
| Parameter | Type | Description |
|---|---|---|
title | string | Window title |
coords | vector3 | Position |
length | number | Window width |
height | number | Window height |
color | string | Hex color |
style | string | Display style (list, basiclist, basic, image, progress, cards, compact) |
data | table | Key-value data to display |
distance | number | Render distance |
heading | number | Direction the window faces (degrees) |
Example
lua
exports['core_focus']:AddAugmentedWindowCoords("GARAGE INFO", vector3(215.0, -800.0, 31.0),
4.0, 2.0, "#00AAFF", "progress", {
["CAPACITY"] = "PROGRESS:75",
["STATUS"] = "OPEN",
}, 50.0, 90.0
)client
exports['core_focus']:AddAugmentedWindowEntity(title, entity, length, height, color, style, data, distance, heading)Adds a floating AR window above a specific entity.
| Parameter | Type | Description |
|---|---|---|
title | string | Window title |
entity | entity | Entity handle |
length | number | Window width |
height | number | Window height |
color | string | Hex color |
style | string | Display style |
data | table | Key-value data |
distance | number | Render distance |
heading | number | Direction |
Example
lua
exports['core_focus']:AddAugmentedWindowEntity("VEHICLE INFO", vehicleEntity,
2.5, 1.0, "#00AAFF", "list", {
["PLATE"] = GetVehicleNumberPlateText(vehicleEntity),
["ENGINE"] = "Running",
}, 10.0, nil
)Remove/update AR elements with: RemoveAugmentedLocation(index), RemoveAugmentedWindow(index), UpdateAugmentedLocation(index, data), UpdateAugmentedWindow(index, data)
Context Menu Exports
client
exports['core_focus']:AddContextMenu(key, data)Adds a new context menu category dynamically at runtime.
| Parameter | Type | Description |
|---|---|---|
key | string | Unique category key |
data | table | Category data (label, icon, color, canShow, options) |
Example
lua
exports['core_focus']:AddContextMenu("mechanic", {
enabled = true,
label = "Mechanic Tools",
icon = "fas fa-wrench",
color = "#f59e0b",
canShow = function()
-- only show for mechanics
return true
end,
options = {
{ label = "Repair Vehicle", icon = "fas fa-car-burst", action = function() end },
{ label = "Check Engine", icon = "fas fa-engine", action = function() end },
}
})client
exports['core_focus']:RemoveContextMenu(key)Removes a context menu category.
| Parameter | Type | Description |
|---|---|---|
key | string | Category key to remove |
Example
lua
exports['core_focus']:RemoveContextMenu("mechanic")Option Table Reference
Every targeting option supports these fields:
lua
{
label = "Option Name", -- Display text (required)
icon = "fas fa-icon-name", -- Font Awesome icon
action = function(entity) end, -- Callback when selected
canInteract = function(entity, dist, data) -- Conditional visibility
return true
end,
distance = 3.0, -- Interaction distance
-- Framework permissions
job = 'police', -- or { police = 2 } for grade
excludejob = 'admin', -- Exclude by job
gang = 'vagos', -- or { vagos = 0 } for grade
excludegang = 'admin', -- Exclude by gang
item = 'lockpick', -- or { 'lockpick', 'keycard' }
citizenid = 'ABC123', -- Specific player only
-- Event triggers (alternative to action)
event = 'client:eventName', -- Trigger client event
serverEvent = 'server:eventName', -- Trigger server event
type = 'client', -- 'client', 'server', or 'command'
}TIP
Permission fields like job, gang, and item work automatically with both QBCore and ESX through the framework integration layer.
