👁️qb-target

Always watching you...

Introduction

qb-target is a targeting solution that allows interaction with any predefined entity, model, entity type or polyzone. While activated you can easily and safely replace markers and distance checking, instead of relying on intuitive design to improve player experiences and optimize interaction.

Features

  • Maintains compatibility with bt-target while providing improved utility and performance

  • Optimized and improved raycasting function allows interaction with a wider range of entities

  • Add generic options to apply for all players, peds, vehicles, or objects

  • Trigger an event, function or command after clicking an option, with the ability to pass any data through

  • Define distance on a per-option or overall basis when triggering a target option

  • Ability to redefine or remove options and add new options without replacing old ones

  • Update the option list when moving towards or away from a target with variable distances on their options

  • Support for entity bones, with built-in tables for opening vehicle doors

  • Support checking for job, gang, citizenid, items, or specific entities

  • Utilise the canInteract function for advanced checks to show or hide an option based on any trigger

  • Ped spawner to spawn peds and assign target options to them all in one place


AddCircleZone

Adds a circular zone that players can interact with

  • name: string

  • center: vector3

  • radius: float

  • options: table

    • name: string

    • debugPoly: boolean

    • useZ: boolean (optional)

  • targetoptions: table

    • options: table

      • num: number (optional)

      • type: string

      • event: string

      • icon: string

      • label: string

      • targeticon: string (optional)

      • item: string (optional)

      • action: function (optional)

      • canInteract: function (optional)

      • job: string or table (optional)

      • gang: string or table (optional)

      • citizenid: string or table (optional)

      • drawDistance: number (optional)

      • drawColor: table (optional)

      • successDrawColor: table (optional)

    • distance: float


AddBoxZone

Adds a rectangular zone that players can interact with

  • name: string

  • center: vector3

  • length: float

  • width: float

  • options: table

    • name: string

    • heading: float

    • debugPoly: boolean

    • minZ: float

    • maxZ: float

  • targetoptions: table

    • options: table

      • num: number (optional)

      • type: string

      • event: string

      • icon: string

      • label: string

      • targeticon: string (optional)

      • item: string (optional)

      • action: function (optional)

      • canInteract: function (optional)

      • job: string or table (optional)

      • gang: string or table (optional)

      • citizenid: string or table (optional)

      • drawDistance: number (optional)

      • drawColor: table (optional)

      • successDrawColor: table (optional)

    • distance: float


AddPolyZone

Adds a custom-shaped polygon zone that players can interact with

  • name: string

  • points: table

    • A list of vector2 points defining the polygon (minimum of 3, must be in drawing order).

  • options: table

    • name: string

    • debugPoly: boolean

    • minZ: float

    • maxZ: float

  • targetoptions: table

    • options: table

      • num: number (optional)

      • type: string

      • event: string

      • icon: string

      • label: string

      • targeticon: string (optional)

      • item: string (optional)

      • action: function (optional)

      • canInteract: function (optional)

      • job: string or table (optional)

      • gang: string or table (optional)

      • citizenid: string or table (optional)

      • drawDistance: number (optional)

      • drawColor: table (optional)

      • successDrawColor: table (optional)

    • distance: float


AddComboZone

Adds a composite zone made up of two or more PolyZones (CircleZone, BoxZone, or PolyZone), treated as a single interactive area

  • zones: table

    • A list of zone objects (must be at least 2), e.g. instances created using BoxZone:Create(...).

  • options: table

    • name: string

    • debugPoly: boolean

  • targetoptions: table

    • options: table

      • num: number (optional)

      • type: string

      • event: string

      • icon: string

      • label: string

      • targeticon: string (optional)

      • item: string (optional)

      • action: function (optional)

      • canInteract: function (optional)

      • job: string or table (optional)

      • gang: string or table (optional)

      • citizenid: string or table (optional)

      • drawDistance: number (optional)

      • drawColor: table (optional)

      • successDrawColor: table (optional)

    • distance: float


AddTargetBone

Adds targetable interaction options to specific bones of vehicles

  • bones: string or table

    • A single bone name or a list of bone names (e.g. "bonnet" or { "bonnet", "boot" }).

  • parameters: table

    • options: table

      • num: number (optional)

      • type: string

      • event: string

      • icon: string

      • label: string

      • targeticon: string (optional)

      • item: string (optional)

      • action: function (optional)

      • canInteract: function (optional)

      • job: string or table (optional)

      • gang: string or table (optional)

      • citizenid: string or table (optional)

    • distance: float

RemoveTargetBone

Removes targeting options from one or more bones on all applicable entities registered via AddTargetBone

  • bones: string or table


AddTargetEntity

Adds interaction options to a specific entity (such as a ped, vehicle, or object)

  • entity: number or table

    • The entity instance or a list of entity instances (from CreatePed, CreateVehicle, etc).

  • parameters: table

    • options: table

      • num: number (optional)

      • type: string

      • event: string

      • icon: string

      • label: string

      • targeticon: string (optional)

      • item: string (optional)

      • action: function (optional)

      • canInteract: function (optional)

      • job: string or table (optional)

      • gang: string or table (optional)

      • citizenid: string or table (optional)

    • distance: float

RemoveTargetEntity

Removes specific target options from an entity by label(s).

  • entity: number or table

  • labels: string or table


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)

  • name: string

  • entity: number

    • The target entity's ID (such as a ped or vehicle created via CreatePed or CreateVehicle).

  • options: table

    • name: string

    • debugPoly: boolean

  • targetoptions: table

    • options: table

      • num: number (optional)

      • type: string

      • event: string

      • icon: string

      • label: string

      • targeticon: string (optional)

      • item: string (optional)

      • action: function (optional)

      • canInteract: function (optional)

      • job: string or table (optional)

      • gang: string or table (optional)

      • citizenid: string or table (optional)

      • drawDistance: number (optional)

      • drawColor: table (optional)

      • successDrawColor: table (optional)

    • distance: float

RemoveEntityZone

Removes a previously registered entity-based zone

  • name: string


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)

  • models: string or table

    • A model name or a list of model names (e.g. "prop_atm_01" or { "prop_atm_01", "prop_atm_02" }).

  • parameters: table

    • options: table

      • num: number (optional)

      • type: string

      • event: string

      • icon: string

      • label: string

      • targeticon: string (optional)

      • item: string (optional)

      • action: function (optional)

      • canInteract: function (optional)

      • job: string or table (optional)

      • gang: string or table (optional)

      • citizenid: string or table (optional)

    • distance: float

RemoveTargetModel

Removes interaction options from one or more models.

  • models: string or table

  • labels: string or table


AddGlobalPed

Adds interaction options that apply to all peds in the world. Useful for universal interactions like restraining or identifying NPCs

parameters: table

  • options: table

    • num: number (optional)

    • type: string

    • event: string

    • icon: string

    • label: string

    • targeticon: string (optional)

    • item: string (optional)

    • action: function (optional)

    • canInteract: function (optional)

    • job: string or table (optional)

    • gang: string or table (optional)

    • citizenid: string or table (optional)

  • distance: float

RemoveGlobalPed

Removes global interaction options from all peds.

  • identifier: string


AddGlobalVehicle

Adds interaction options to all vehicles globally.

  • parameters: table

RemoveGlobalVehicle

Removes global options from all vehicles.

  • labels: string or table


AddGlobalObject

Adds interaction options to all static world objects globally.

  • parameters: table

RemoveGlobalObject

Removes global options from all world objects.

  • labels: string or table


AddGlobalPlayer

Adds interaction options to all player entities globally

  • parameters: table

RemoveGlobalPlayer

Removes global options that apply to all player entities.

  • labels: string or table


SpawnPed

Spawns one or multiple peds with optional animations, relationships, weapons, and targeting

  • datatable: table

    • model: string

    • coords: vector4

    • freeze: boolean (optional)

    • invincible: boolean (optional)

    • blockevents: boolean (optional)

    • animDict: string (optional)

    • anim: string (optional)

    • flag: number (optional)

    • scenario: string (optional)

    • pedrelations: table (optional)

      • groupname: string

      • toowngroup: number

      • toplayer: number

    • weapon: table (optional)

      • name: string

      • ammo: number

      • hidden: boolean

    • target: table (optional)

      • useModel: boolean

      • options: table

        • type: string

        • event: string

        • icon: string

        • label: string

      • distance: float

    • action: function (optional)

RemoveSpawnedPed

Removes one or more peds previously spawned with SpawnPed

  • peds: number or table


RemoveGlobalTypeOptions

Removes options from a global target type (e.g. peds, vehicles).

  • type: number (1 for peds, 2 for vehicles, 3 for objects, 4 for players)

  • labels: string or table


RemoveZone

Removes a zone that was previously added using AddCircleZone, AddBoxZone, AddPolyZone, or AddComboZone

  • name: string


RaycastCamera

Performs a raycast from the camera's viewpoint to detect the closest entity in the crosshair.

  • flag: number

  • playerCoords: vector3


AllowTargeting

Enables or disables qb-target interactions for the player

  • allow: boolean

Last updated

Was this helpful?