Skip to content

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:

ParameterTypeDescription
forceColorstring (hex)Forces the targeting dot and radial menu to use this specific color
forceSeperatebooleanForces 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

clientexports['core_focus']:AddBoxZone(name, coords, length, width, options, targetOptions)

Creates a box-shaped targeting zone at the specified coordinates.

ParameterTypeDescription
namestringUnique zone identifier
coordsvector3Center position
lengthnumberZone length
widthnumberZone width
optionstablePolyZone options (heading, minZ, maxZ, debugPoly)
targetOptionstableTarget options table with options array and distance
Returns: zone
Example
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"
})
clientexports['core_focus']:AddCircleZone(name, coords, radius, options, targetOptions)

Creates a circular targeting zone.

ParameterTypeDescription
namestringUnique zone identifier
coordsvector3Center position
radiusnumberZone radius
optionstablePolyZone options
targetOptionstableTarget options table
Returns: zone
Example
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
})
clientexports['core_focus']:AddSphereZone(name, coords, radius, options, targetOptions)

Creates a sphere-shaped targeting zone (3D radius check).

ParameterTypeDescription
namestringUnique zone identifier
coordsvector3Center position
radiusnumberSphere radius
optionstablePolyZone options
targetOptionstableTarget options table
Returns: zone
Example
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
})
clientexports['core_focus']:AddPolyZone(name, points, options, targetOptions)

Creates a polygon-shaped targeting zone from an array of points.

ParameterTypeDescription
namestringUnique zone identifier
pointsvector3[]Array of polygon corner points
optionstablePolyZone options
targetOptionstableTarget options table
Returns: zone
Example
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
})
clientexports['core_focus']:AddEntityZone(name, entity, options, targetOptions)

Creates a targeting zone attached to a specific entity.

ParameterTypeDescription
namestringUnique zone identifier
entityentityEntity handle
optionstablePolyZone options
targetOptionstableTarget options table
Returns: zone
Example
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"
})
clientexports['core_focus']:RemoveZone(name)

Removes a previously created targeting zone by name.

ParameterTypeDescription
namestringZone identifier to remove
Example
lua
exports['core_focus']:RemoveZone("bank_vault")

Entity & Model Exports

clientexports['core_focus']:AddTargetEntity(entities, params)

Adds targeting options to specific entity handles.

ParameterTypeDescription
entitiesentity | entity[]Single entity or array of entities
paramstableOptions 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
})
clientexports['core_focus']:RemoveTargetEntity(entities, labels)

Removes specific options from entities by label.

ParameterTypeDescription
entitiesentity | entity[]Entity or array of entities
labelsstring[]Array of option labels to remove
Example
lua
exports['core_focus']:RemoveTargetEntity(myPed, { "Interact" })
clientexports['core_focus']:AddTargetModel(models, params)

Adds targeting options to all entities matching the given model hash(es).

ParameterTypeDescription
modelshash | hash[]Model hash or array of hashes
paramstableOptions 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"
})
clientexports['core_focus']:RemoveTargetModel(models, labels)

Removes specific options from model targets by label.

ParameterTypeDescription
modelshash | hash[]Model hash or array of hashes
labelsstring[]Array of option labels to remove
Example
lua
exports['core_focus']:RemoveTargetModel({ `prop_atm_01` }, { "Use ATM" })

Bone Exports

clientexports['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.

ParameterTypeDescription
bonesstring | string[]Bone name(s) — e.g. boot, bonnet, door_dside_f, SKEL_Head
paramstableOptions 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"
})
clientexports['core_focus']:RemoveTargetBone(bones, labels)

Removes specific options from bone targets by label.

ParameterTypeDescription
bonesstring | string[]Bone name(s) to remove from
labelsstring[]Array of option labels to remove
Example
lua
exports['core_focus']:RemoveTargetBone("boot", { "Open Trunk" })

Supported Vehicle Bones:

CategoryBones
Bodychassis, bodyshell, bonnet, boot
Doorsdoor_dside_f, door_dside_r, door_pside_f, door_pside_r
Windowswindscreen, window_lf, window_lr, window_rf, window_rr
Wheelswheel_lf, wheel_lr, wheel_rf, wheel_rr
Seatsseat_dside_f, seat_dside_r, seat_pside_f, seat_pside_r
Otherengine, 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

clientexports['core_focus']:AddGlobalPed(params)

Adds targeting options to ALL peds in the world.

ParameterTypeDescription
paramstableOptions 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
})
clientexports['core_focus']:AddGlobalVehicle(params)

Adds targeting options to ALL vehicles in the world.

ParameterTypeDescription
paramstableOptions 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
})
clientexports['core_focus']:AddGlobalObject(params)

Adds targeting options to ALL objects in the world.

ParameterTypeDescription
paramstableOptions table
Example
lua
exports['core_focus']:AddGlobalObject({
    options = {
        { label = "Inspect", icon = "fas fa-eye", action = function(entity) end }
    },
    distance = 2.0
})
clientexports['core_focus']:AddGlobalPlayer(params)

Adds targeting options to ALL player peds.

ParameterTypeDescription
paramstableOptions 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

clientexports['core_focus']:AllowTargeting(state)

Enables or disables the entire targeting system.

ParameterTypeDescription
statebooleantrue 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)
clientexports['core_focus']:IsTargetActive()

Returns whether the targeting menu is currently open.

Returns: boolean
Example
lua
if exports['core_focus']:IsTargetActive() then
    print('Player is targeting')
end
clientexports['core_focus']:DisableTarget(force)

Force closes the radial targeting menu.

ParameterTypeDescription
forcebooleanForce close immediately
Example
lua
exports['core_focus']:DisableTarget(true)
clientexports['core_focus']:RaycastCamera(flag, playerCoords)

Casts a ray from the camera forward. Useful for custom targeting logic.

ParameterTypeDescription
flagnumberRaycast flags (entity types to detect)
playerCoordsvector3Optional player position override
Returns: endCoords, distance, entityHit, entityType
Example
lua
local endCoords, dist, entity, entityType = exports['core_focus']:RaycastCamera(30)
if entity ~= 0 then
    print('Hit entity at distance:', dist)
end
clientexports['core_focus']:SpawnPed(data)

Spawns an NPC ped with targeting options attached.

ParameterTypeDescription
datatablePed 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

clientexports['core_focus']:AddAugmentedLocation(name, coords, height, color, distance, ground)

Adds a new AR border to the world at runtime.

ParameterTypeDescription
namestringDisplay name
coordsvector3[]Corner points
heightnumberBorder height
colorstringHex color
distancenumberRender distance
groundstring|numberGround 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')
clientexports['core_focus']:AddAugmentedWindowCoords(title, coords, length, height, color, style, data, distance, heading)

Adds a floating AR information window at coordinates.

ParameterTypeDescription
titlestringWindow title
coordsvector3Position
lengthnumberWindow width
heightnumberWindow height
colorstringHex color
stylestringDisplay style (list, basiclist, basic, image, progress, cards, compact)
datatableKey-value data to display
distancenumberRender distance
headingnumberDirection 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
)
clientexports['core_focus']:AddAugmentedWindowEntity(title, entity, length, height, color, style, data, distance, heading)

Adds a floating AR window above a specific entity.

ParameterTypeDescription
titlestringWindow title
entityentityEntity handle
lengthnumberWindow width
heightnumberWindow height
colorstringHex color
stylestringDisplay style
datatableKey-value data
distancenumberRender distance
headingnumberDirection
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

clientexports['core_focus']:AddContextMenu(key, data)

Adds a new context menu category dynamically at runtime.

ParameterTypeDescription
keystringUnique category key
datatableCategory 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 },
    }
})
clientexports['core_focus']:RemoveContextMenu(key)

Removes a context menu category.

ParameterTypeDescription
keystringCategory 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.