Api
🛠️ The options Table
options TableWhenever you add a target (to an entity, model, zone, or globally), you must pass an options table. This defines what the player sees and what happens when they click the option.
Option Parameters
Parameter
Type
Description
name
string
A unique identifier for the option.
label
string
The text displayed in the target menu.
icon
string
The FontAwesome icon class (e.g., 'fas fa-car').
description
string
(Optional) Extra description text below the label.
distance
number
The maximum distance the player can interact from.
bones
string / table
(Optional) Specific entity bones the player must look at.
offset
vector3
(Optional) Offset from the entity's center.
groups
string / table
(Optional) Restrict to specific jobs, gangs, or citizen IDs.
items
string / table
(Optional) Restrict to players carrying specific item(s).
anyItem
boolean
(Optional) If true, the player only needs one of the specified items.
canInteract
function
(Optional) A custom check function returning true or false.
Action Handlers (Pick One)
You must define one of the following to execute an action when the player clicks the option:
onSelectoraction: A direct Lua callback function. Receives adatatable(entity, coords, distance, zone).event: Triggers a Client Event.serverEvent: Triggers a Server Event (automatically converts entity tonetId).command: Executes a console command.export: Calls an export formatted as'resourceName.exportName'.
Example Option Table
🌍 Global Targets
Global targets apply to every entity of a specific type across the entire map.
addGlobalPed
addGlobalPedAdds options to all Peds.
addGlobalVehicle
addGlobalVehicleAdds options to all Vehicles.
addGlobalObject
addGlobalObjectAdds options to all Objects.
addGlobalPlayer
addGlobalPlayerAdds options to all other Players.
addGlobalOption
addGlobalOptionAdds an option anywhere in the world (catches world coordinates if no entity is hit).
📦 Model & Entity Targets
addModel
addModelAdds options to specific entity models (props, vehicle models, ped models).
addEntity (Networked)
addEntity (Networked)Adds options to specific networked entities using their netId.
addLocalEntity (Non-Networked)
addLocalEntity (Non-Networked)Adds options to specific local entities using their local entity ID.
📍 Zone Targets
Zones allow you to define 3D areas in the world that act as targets without needing a physical prop.
addSphereZone
addSphereZoneCreates a spherical interaction zone. Returns a unique Zone ID.
addBoxZone
addBoxZoneCreates a rectangular interaction box. Returns a unique Zone ID.
addPolyZone
addPolyZoneCreates a custom polygon interaction zone. Returns a unique Zone ID.
🗑️ Removing Targets
Use these exports to clean up targets, especially inside onResourceStop handlers.
removeGlobalPed(labels)removeGlobalVehicle(labels)removeGlobalObject(labels)removeGlobalPlayer(labels)removeGlobalOption(labels)
Note: labels can be a single string (the option name or label) or a table of strings.
Removing Models & Entities:
Removing Zones:
Pass the Zone ID returned when you created it.
⚙️ Utility Exports
disableTargeting
disableTargetingTemporarily disable or re-enable the targeting eye.
isDisabled
isDisabledCheck if targeting is currently disabled.
zoneExists
zoneExistsCheck if a specific zone ID is currently active.
Last updated