TargetOptions

TargetOptions

All target actions are formated as an array containing objects with the following properties.

TargetOption

  • label: string

  • name?: string

    • An identifier used when removing an option.

  • icon?: string

  • 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

Callback

This is the data returned to a registered callback or event for selected option.

A selected option will trigger a single action, in order of priority:

  1. onSelect

  2. export

  3. event

  4. server event

  5. command

  • data: table

    • entity: number

      • The id of the entity hit by the shape test. If triggering a server event, this is the network id instead.

    • coords: vector3

      • The resulting coordinates where the shape test hit a collision.

    • distance: number

      • The player's distance from the coords.

    • zone?: number

      • The id of the selected zone, if applicable.

Last updated