Skip to main content

Target Options

  • label: string
  • name?: string
    • An identifier used when removing an option.
  • icon?: string
    • Name of a Font Awesome icon.
  • iconColor?: string
  • distance?: number
    • The max distance to display the option.
  • bones?: string or string[]
  • offset?: vector3
    • Offset the targetable area of an entity, relative to the model dimensions.
  • offsetAbsolute?: vector3
    • Offset the targetable area of an entity, relative to the entity’s world coords.
  • offsetSize?: number
    • The radius of the targetable area for an entity offset.
  • groups?: string or string[] or table<string, number>
    • A group, array of groups, or pairs of groups-grades required to show the option.
    • Groups are framework dependent, and may refer to jobs, gangs, etc.
  • items?: string or string[] or table<string, number>
    • An item, array of items, or pairs of items-count required to show the option.
    • Items are framework dependent.
  • anyItem?: boolean
    • Only require a single item from the items table to exist.
  • canInteract?: function(entity, distance, coords, name, bone)
    • Options will always display if this is undefined.
  • menuName?: string
    • The option is only displayed when a menu has been set with openMenu.
  • openMenu?: string
    • Sets the current menu name, displaying only options for the menuName.
  • onSelect?: function(data)
  • export?: string
  • event?: string
  • serverEvent?: string
  • command?: string

Overview

ox_target (previously known as qtarget) is a performant and flexible targeting resource for RedM. It allows players to interact with entities, zones, and models using a “third-eye” targeting system.
ox_target is already included and used extensively in RSG Framework resources!

Installation

ox_target is already included in RSG Framework. To use it in your custom resources:
fxmanifest.lua

Entity Targeting

addEntity

Add targeting options to a specific entity.
Parameters:
  • entity (number) - The entity handle
  • options (table) - Array of target options
Example:

removeEntity

Remove targeting options from a specific entity.
Parameters:
  • entity (number) - The entity handle
  • optionNames (string|table|nil) - Specific option names to remove, or nil to remove all
Example:

Model Targeting

addModel

Add targeting options to all entities with specific models.
Parameters:
  • models (string|number|table) - Model hash(es) or name(s)
  • options (table) - Array of target options
Example:

removeModel

Remove targeting options from models.
Parameters:
  • models (string|number|table) - Model hash(es) or name(s)
  • optionNames (string|table|nil) - Option names to remove, or nil for all
Example:

Zone Targeting

addBoxZone

Add a box-shaped targeting zone.
Parameters:
  • name (string) - Unique zone identifier
  • coords (vector3) - Center coordinates
  • size (vector3) - Box dimensions (length, width, height)
  • rotation (number) - Rotation in degrees
  • options (table) - Array of target options
  • targetoptions (table) - Additional zone settings
Example:

addSphereZone

Add a sphere-shaped targeting zone.
Parameters:
  • name (string) - Unique zone identifier
  • coords (vector3) - Center coordinates
  • radius (number) - Sphere radius
  • options (table) - Array of target options
  • targetoptions (table) - Additional zone settings
Example:

removeZone

Remove a targeting zone.
Parameters:
  • name (string) - Zone identifier
Example:

Advanced Options

Job Restrictions

Restrict interactions to specific jobs:

Item Requirements

Require specific items to see the interaction:

Distance Control

Control interaction distance:

Bone Targeting

Target specific entity bones:

Can Interact Function

Dynamic interaction visibility:

Event Types

Different ways to handle interactions:

Complete Examples

Example 1: NPC Shopkeeper


Example 2: Job-Restricted Zones


Example 3: Crafting Station


Example 4: Dynamic Hitching Posts


Best Practices

Use canInteract for dynamic visibility: Hide options that aren’t currently available instead of showing disabled options
Always validate on server: Never trust client-side data. Always re-check permissions and items on the server
Use appropriate distances: Keep interaction distances realistic (1.5-3.0 for most interactions)

Performance Tips

  1. Don’t add too many zones: Each zone checks distance every frame
  2. Use models over entities: Model targeting is more efficient than entity targeting for common objects
  3. Efficient canInteract: Keep canInteract functions lightweight
  4. Clean up when done: Remove zones/entities when they’re no longer needed

Troubleshooting

  • Check distance - are you close enough?
  • Verify canInteract function isn’t returning false
  • Check job/gang/item requirements
  • Ensure ox_target is started before your resource
  • Verify the groups parameter is set correctly
  • Check player’s actual job name (not label)
  • Ensure grade requirements are correct
  • Check zone coordinates are correct
  • Verify size/radius is appropriate
  • Make sure zone name is unique
  • Check for Lua errors in F8 console

For more advanced usage, check the official ox_target documentation: https://overextended.dev/ox_target