Skip to content

Replace a partThe bundled resources

Targeting (rlx_target) ​

Holding Alt (action target of the keys) shows an eye in the center. On something with options, the eye turns blue and the list shows next to it; left click: the cursor appears, click the option (a single option: chosen directly). GTA's key bar shows the left-click icon. Releasing Alt, Escape or right click: closed. Nothing is outlined.

Options are declared by resources, on the server, and checked again by the server (job, item, distance, model, zone):

lua
RLX.AddTarget({
  id = "atm", label = "Use the ATM",
  type = "object",                 -- "vehicle", "ped", "player", "object" or "zone"
  models = { "prop_atm_01", "prop_atm_02", "prop_atm_03", "prop_fleeca_atm" },
  distance = 1.5, job = nil, item = nil, owned = nil, order = 10,
  -- ped = "shopkeeper"                          only this RLX NPC (RLX.AddPed id)
  -- prop = "stall_1"                            only this RLX prop (RLX.AddProp id)
  -- meta = { key = "myres:kind", value = "atm" }  only entities carrying this meta
}, function(source, info)
  -- info = { netId?, player?, model, coords, plate? }
end)

-- A zone: anything aimed at inside it (counter, desk, door, map scenery).
RLX.AddTarget({ id = "reception", label = "Talk to the reception", type = "zone",
  coords = { x = 441.8, y = -982.0, z = 30.7 }, radius = 1.2 }, function(source, info) end)

The LS:MP "picker" reads what is drawn under the eye: it finds the map scenery (ATMs, pumps), even without collision, and gives the aimed position (hence zones). A scenery object has no netId: models is then required. Optional: everything targetable also has a key or a point (L for the keys, E in the stations). No targeting from a vehicle (TargetConfig.inVehicle). The type (vehicle, ped, object) is asked from the game: the LS:MP picker sometimes reports it wrong (a car as "object", a pump without a type). /targetdebug: on-screen diagnostics (what the eye sees, and why each option is left out). On the client: RLX.GetTargetOptions(info), RLX.RunTarget(key, info) for your own display. Hook target.