Api

🛠️ The options Table

Whenever 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:

  • onSelect or action: A direct Lua callback function. Receives a data table (entity, coords, distance, zone).

  • event: Triggers a Client Event.

  • serverEvent: Triggers a Server Event (automatically converts entity to netId).

  • 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

Adds options to all Peds.

addGlobalVehicle

Adds options to all Vehicles.

addGlobalObject

Adds options to all Objects.

addGlobalPlayer

Adds options to all other Players.

addGlobalOption

Adds an option anywhere in the world (catches world coordinates if no entity is hit).


📦 Model & Entity Targets

addModel

Adds options to specific entity models (props, vehicle models, ped models).

addEntity (Networked)

Adds options to specific networked entities using their netId.

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

Creates a spherical interaction zone. Returns a unique Zone ID.

addBoxZone

Creates a rectangular interaction box. Returns a unique Zone ID.

addPolyZone

Creates 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

Temporarily disable or re-enable the targeting eye.

isDisabled

Check if targeting is currently disabled.

zoneExists

Check if a specific zone ID is currently active.

Last updated