๐ฏTargets
UNIQUE FEATURES
Core Focus primaraly uses exactly the same export structure as in qb-target. There are a couple new variables that can be used when registering targets using core_focus, ox_target, qtarget exports. Usually put after options table besides distance variable.
forceColor
string (hex code)
Forces the "dot" and radial menu use this defined color.
forceSeperate
bool (true or false)
Forces the given options to form another "dot" and not merge with existing options
EXPORTS
AddCircleZone
Adds a circular zone that players can interact with
Usage :
exports.core_focus:AddCircleZone("police_armory", vector3(452.6, -980.0, 30.6), 1.5, {
name = "police_armory",
debugPoly = false,
useZ = true -- optional
}, {
options = {
{
num = 1, -- optional
type = "client",
event = "police:openArmory",
icon = "fas fa-archive",
label = "Open Armory",
targeticon = "fas fa-gun", -- optional
item = "police_badge", -- optional
action = function(entity) -- optional
if IsPedAPlayer(entity) then return false end
TriggerEvent("police:openArmoryMenu", entity)
end,
canInteract = function(entity, distance, data) -- optional
return not IsPedAPlayer(entity)
end,
job = { ["police"] = 0, ["sheriff"] = 1 }, -- optional
gang = { ["thelostmc"] = 2 }, -- optional
citizenid = { ["JFD98238"] = true, ["HJS29340"] = true }, -- optional
drawDistance = 10.0, -- optional
drawColor = {255, 255, 255, 255}, -- optional
successDrawColor = {0, 255, 0, 255} -- optional
}
},
distance = 2.5,
forceColor = '#3d24ab', -- optional
forceSeperate = true -- optional
})
AddBoxZone
Adds a rectangular zone that players can interact with
Usage :
exports.core_focus:AddBoxZone("mechanic_workbench", vector3(-1150.7, -2005.1, 13.2), 1.5, 3.0, {
name = "mechanic_workbench",
heading = 90.0,
debugPoly = false, -- optional
minZ = 12.5,
maxZ = 14.0
}, {
options = {
{
num = 1, -- optional
type = "client",
event = "mechanic:client:RepairVehicle",
icon = "fas fa-wrench",
label = "Repair Vehicle",
targeticon = "fas fa-car-crash", -- optional
canInteract = function(entity, distance, data)
return IsEntityAVehicle(entity)
end,
job = { ["mechanic"] = 0 } -- optional
},
{
num = 2, -- optional
type = "client",
action = function(entity)
if IsEntityAVehicle(entity) then
TriggerServerEvent("mechanic:server:OpenUpgradeMenu")
end
end, -- optional
icon = "fas fa-arrow-up",
label = "Upgrade Vehicle",
item = "advanced_toolkit", -- optional
gang = { ["lostmc"] = 0, ["ballas"] = 0 }, -- optional
citizenid = { ["KAI00001"] = true }, -- optional
drawDistance = 2.0, -- optional
drawColor = {255, 165, 0, 200}, -- optional
successDrawColor = {0, 255, 127, 255} -- optional
}
},
distance = 2.5,
forceColor = "#c75ae0", -- optional
forceSeperate = true -- optional
})
AddPolyZone
Adds a custom-shaped polygon zone that players can interact with
Usage :
-- Define the points for the polygon shape on the ground
local points = {
vector2(-75.5, -820.0),
vector2(-78.0, -822.5),
vector2(-81.5, -821.0),
vector2(-80.0, -817.5),
vector2(-77.0, -817.0)
}
exports.core_focus:AddPolyZone("rooftop_helipad", points, {
name = "rooftop_helipad",
debugPoly = false, -- optional
minZ = 320.0,
maxZ = 322.0
}, {
options = {
{
num = 1, -- optional
type = "server",
event = "heli:server:requestHeli",
icon = "fas fa-helicopter",
label = "Request Helicopter",
item = "gold_membership_card", -- optional
job = { ["pilot"] = 0 } -- optional
},
{
num = 2, -- optional
type = "client",
action = function() -- optional
-- Assume this triggers a cleaning minigame or animation
TriggerEvent("maintenance:client:cleanArea")
end,
icon = "fas fa-broom",
label = "Clean Helipad",
canInteract = function(entity, distance, data) -- optional
local playerPed = PlayerPedId()
-- Only allow interaction if the player is not in a vehicle
return not IsPedInAnyVehicle(playerPed, false)
end,
job = { ["maintenance"] = 0 }, -- optional
drawDistance = 5.0, -- optional
drawColor = {255, 255, 0, 150}, -- optional
successDrawColor = {255, 192, 203, 255} -- optional
}
},
distance = 3.0,
forceColor = "#ffab40", -- optional
forceSeperate = true -- optional
})
AddComboZone
Adds a composite zone made up of two or more PolyZones (CircleZone, BoxZone, or PolyZone), treated as a single interactive area
Usage :
-- Create the first console zone for the generator
local powerConsoleA = BoxZone:Create(vector3(895.0, -180.0, 78.0), 1.0, 1.5, {
name = "powerConsoleA",
heading = 90.0,
debugPoly = false,
minZ = 77.5,
maxZ = 79.0
})
-- Create the second console zone
local powerConsoleB = BoxZone:Create(vector3(900.0, -180.0, 78.0), 1.0, 1.5, {
name = "powerConsoleB",
heading = 90.0,
debugPoly = false,
minZ = 77.5,
maxZ = 79.0
})
-- Combine the two zones into a single target that requires players in both
exports.core_focus:AddComboZone({ powerConsoleA, powerConsoleB }, {
name = "generator_controls",
debugPoly = false -- optional
}, {
options = {
{
num = 1, -- optional
type = "server",
event = "powerplant:server:activateGenerator",
icon = "fas fa-bolt",
label = "Activate Main Power",
targeticon = "fas fa-power-off", -- optional
item = "access_card", -- optional
canInteract = function(entity, distance, data) -- optional
-- Example check to see if the generator is already on
return not IsGeneratorActive
end,
job = { ["engineer"] = 0 }, -- optional
drawDistance = 10.0, -- optional
drawColor = {255, 200, 0, 200}, -- optional
successDrawColor = {124, 252, 0, 255} -- optional
}
},
distance = 1.5,
forceColor = "#ffc107", -- optional
forceSeperate = true -- optional
})
AddTargetBone
Adds targetable interaction options to specific bones of entities
Usage :
-- A list of all wheel bones on a standard vehicle
local bones = { "wheel_lf", "wheel_rf", "wheel_lr", "wheel_rr" }
exports.core_focus:AddTargetBone(bones, {
options = {
{
num = 1, -- optional
type = "client",
action = function(entity, data) -- optional
-- data.bone contains the name of the specific bone that was targeted
print("Changing tire on bone: " .. data.bone)
TriggerEvent("vehicle:client:changeTire", entity, data.bone)
end,
icon = "fas fa-tire-flat",
label = "Change Tire",
item = "tire_iron", -- optional
canInteract = function(entity, distance, data) -- optional
if not IsEntityAVehicle(entity) then return false end
-- Check if the specific tire targeted is actually damaged
return GetVehicleTyreHealth(entity, data.boneIndex) < 950.0
end,
job = { ["tow"] = 0 }, -- optional
}
},
distance = 1.5,
forceColor = "#adb5bd", -- optional
forceSeperate = true -- optional
})
RemoveTargetBone
Removes targeting options from one or more bones on all applicable entities registered via AddTargetBone
Usage :
exports.core_focus:RemoveTargetBone({ "wheel_lf", "wheel_rf", "wheel_lr", "wheel_rr" })
AddTargetEntity
Adds interaction options to a specific entity (such as a ped, vehicle, or object)
Usage :
CreateThread(function()
local model = `prop_hotdogstand_01`
RequestModel(model)
while not HasModelLoaded(model) do Wait(0) end
-- Create a prop entity instead of a ped
local hotdogStand = CreateObject(model, 15.5, -1345.8, 29.5, true, true, false)
PlaceObjectOnGroundProperly(hotdogStand)
FreezeEntityPosition(hotdogStand, true)
exports.core_focus:AddTargetEntity(hotdogStand, {
options = {
{
num = 1, -- optional
type = "server",
event = "food:server:buyHotdog",
icon = "fas fa-hotdog",
label = "Buy Hotdog ($5)",
action = function(entity) -- optional
-- This can be used for client-side effects before a server event
print("Trying to buy a hotdog!")
end,
canInteract = function(entity, distance, data) -- optional
local playerPed = PlayerPedId()
return not IsPedInAnyVehicle(playerPed, false)
end
}
},
distance = 1.5,
forceColor = "#dc3545", -- optional
forceSeperate = true -- optional
})
end)
RemoveTargetEntity
Removes specific target options from an entity by label(s).
Usage :
exports.core_focus:RemoveTargetEntity(hotdogStand, "Buy Hotdog ($5)")
AddEntityZone
Adds a target zone that is dynamically attached to a specific entity. Useful for treating an entity like a movable zone (e.g. attaching interaction to a ped or vehicle)
Usage :
CreateThread(function()
local model = `taxi`
RequestModel(model)
while not HasModelLoaded(model) do Wait(0) end
-- Spawn a taxi at a taxi stand location
local taxiVehicle = CreateVehicle(model, 895.5, -175.0, 78.5, 180.0, true, false)
SetVehicleDoorsLocked(taxiVehicle, 2) -- Lock all doors
SetVehicleEngineOn(taxiVehicle, false, true, true)
exports.core_focus:AddEntityZone("taxi_fast_travel", taxiVehicle, {
name = "taxi_fast_travel",
debugPoly = false -- optional
}, {
options = {
{
num = 1, -- optional
type = "client",
action = function(entity) -- optional
TriggerEvent("fasttravel:client:start", "downtown")
end,
icon = "fas fa-city",
label = "Travel to Downtown",
canInteract = function(entity, distance, data) -- optional
return GetVehicleClass(entity) == 9 -- 9 is the Taxi vehicle class
end,
},
{
num = 2, -- optional
type = "client",
action = function(entity) -- optional
TriggerEvent("fasttravel:client:start", "beach")
end,
icon = "fas fa-umbrella-beach",
label = "Travel to Vespucci Beach",
job = { ["taxi"] = 0 } -- optional
}
},
distance = 3.0,
forceColor = "#ffc107", -- optional
forceSeperate = true -- optional
})
end)
RemoveEntityZone
Removes a previously registered entity-based zone
Usage :
exports.core_focus:RemoveEntityZone("taxi_fast_travel")
AddTargetModel
Adds interaction options to one or more models, allowing players to interact with all entities of those models (e.g. specific ped, vehicle, or prop types)
Usage :
-- A list of common vending machine models
local models = {
"prop_vend_soda_01",
"prop_vend_soda_02",
"prop_vend_water_01"
}
exports.core_focus:AddTargetModel(models, {
options = {
{
num = 1, -- optional
type = "server",
event = "vending:server:buyDrink",
icon = "fas fa-glass-whiskey",
label = "Buy Drink",
action = function(entity) -- optional
-- This action can run on the client before the server event
-- to determine which machine was used.
local model = GetEntityModel(entity)
if model == GetHashKey("prop_vend_water_01") then
print("Buying some water!")
else
print("Buying some soda!")
end
end,
canInteract = function(entity, distance, data) -- optional
-- Example: Check if the vending machine has power
return IsVendingMachinePowered(entity)
end
}
},
distance = 1.2,
forceColor = "#28a745", -- optional
forceSeperate = true -- optional
})
RemoveTargetModel
Removes interaction options from one or more models.
Usage :
exports.core_focus:RemoveTargetModel(models, "Buy Drink")
AddGlobalPed
Adds interaction options that apply to all peds in the world. Useful for universal interactions like restraining or identifying NPCs
Usage :
exports.core_focus:AddGlobalPed({
options = {
{
num = 1, -- optional
type = "client",
action = function(entity) -- optional
TriggerEvent("ems:client:checkVitals", entity)
end,
icon = "fas fa-heartbeat",
label = "Check Vitals",
canInteract = function(entity, distance, data) -- optional
-- Only allow interaction on NPC peds that are not dead
return not IsPedAPlayer(entity) and not IsPedDeadOrDying(entity, true)
end,
job = { ["ems"] = 0 }, -- optional
}
},
distance = 2.0,
forceColor = "#007bff", -- optional
forceSeperate = true -- optional
})
RemoveGlobalPed
Removes global interaction options from all peds.
Usage :
exports.core_focus:RemoveGlobalPed("Check Vitals")
AddGlobalVehicle
Adds interaction options to all vehicles globally.
Usage :
exports.core_focus:AddGlobalVehicle({
options = {
{
num = 1, -- optional
type = "server",
event = "police:server:checkVehiclePlate",
icon = "fas fa-id-card",
label = "Check License Plate",
targeticon = "fas fa-car", -- optional
canInteract = function(entity, distance, data) -- optional
local playerPed = PlayerPedId()
-- Only allow interaction if the player is not in a vehicle
return not IsPedInAnyVehicle(playerPed, false)
end,
job = { ["police"] = 0 }, -- optional
}
},
distance = 3.0,
forceColor = "#0d6efd", -- optional
forceSeperate = true -- optional
})
RemoveGlobalVehicle
Removes global options from all vehicles.
Usage :
exports.core_focus:RemoveGlobalVehicle("Check License Plate")
AddGlobalObject
Adds interaction options to all static world objects globally.
Usage :
exports.core_focus:AddGlobalObject({
options = {
{
num = 1, -- optional
type = "client",
action = function(entity) -- optional
-- A real script might play an effect before deleting the object
DeleteObject(entity)
end,
icon = "fas fa-fire-extinguisher",
label = "Extinguish Fire",
item = "fire_extinguisher", -- optional
canInteract = function(entity, distance, data) -- optional
if not DoesEntityExist(entity) then return false end
-- A simple check to see if the object is likely a fire prop.
-- A more robust script would check against a table of specific model hashes.
local modelName = GetEntityModelName(entity)
return modelName and string.find(modelName, "fire")
end,
job = { ["fire"] = 0 }, -- optional
}
},
distance = 4.0,
forceColor = "#fd7e14", -- optional
forceSeperate = true -- optional
})
RemoveGlobalObject
Removes global options from all world objects.
Usage :
exports.core_focus:RemoveGlobalObject("Extinguish Fire")
AddGlobalPlayer
Adds interaction options to all player entities globally
Usage :
exports.core_focus:AddGlobalPlayer({
options = {
{
num = 1, -- optional
type = "server",
event = "police:server:cuffPlayer",
icon = "fas fa-hands",
label = "Place in Cuffs",
item = "handcuffs", -- optional
canInteract = function(entity, distance, data) -- optional
-- Prevents cuffing yourself, players who are already cuffed, or dead players
return entity ~= PlayerPedId() and not IsPedCuffed(entity) and not IsPedDeadOrDying(entity, true)
end,
job = { ["police"] = 0 }, -- optional
}
},
distance = 1.5,
forceColor = "#0d6efd", -- optional
forceSeperate = true -- optional
})
RemoveGlobalPlayer
Removes global options that apply to all player entities.
Usage :
exports.core_focus:RemoveGlobalPlayer("Place in Cuffs")
Last updated