Skip to main content
Every function is a client export of ug-target. Options belong to the resource that added them and are removed when it stops. Mistakes raise at once, with the export name and the field.

Where options go

Each Add has a Remove with the same first argument and optional option names: RemoveModel('prop_atm_01', 'atm'). Without names, every option of the calling resource goes. RemoveZone(idOrName) and ZoneExists(idOrName) take a zone id or name. options is one option or a list of up to 64. An option with the name of one your resource already added replaces it.

Option fields

An option needs one of onSelect, event, command, export, serverAction, serverEvent or openMenu. Several MAY be set: they run in that order.

Conditions

Jobs and gangs come from ug-core statebags, items from ug-core’s inventory module. A failed condition shows the option greyed out with its reason, or hides it when showDisabled is off. Server actions check the same conditions again on the server.

Context

onSelect, canInteract, event and export receive:

State

  • Disable(state): turns targeting off while any resource asks, such as a phone or a cutscene.
  • IsActive(): true while the player aims.
  • The local event ug-target:Toggled fires with true and false when targeting opens and closes, for HUDs.