Options
Every field an interaction option takes, including rw_interact's additions for descriptions, badges, hold-to-confirm and submenus.
An option is a table. Every ox_target field works as it does there; the ones marked new are rw_interact's own and are ignored by other target resources.
{
name = 'repair_engine',
label = 'Fix Engine',
description = 'Hold to repair', -- new
icon = 'engine',
iconColor = '#fb923c',
badges = { { icon = 'tool', color = '#38bdf8' } }, -- new
distance = 2.0,
groups = { mechanic = 1 },
items = 'repair_kit',
hold = 2500, -- new
canInteract = function(entity, distance, coords, name, bone)
return GetVehicleEngineHealth(entity) < 1000
end,
onSelect = function(data)
SetVehicleEngineHealth(data.entity, 1000.0)
end,
}Display
| Field | Type | |
|---|---|---|
label | string | Required. |
description | string? | new Second line under the focused option. |
icon | string? | See Icons. |
iconColor | string? | #RRGGBB |
badges | { icon, color? }[]? | new Extra small icons beside the focused option. |
name | string? | Lets you remove the option by name. |
Reach
| Field | Type | |
|---|---|---|
distance | number? | Metres from the ped. Default from /interactAdmin (2.0). |
bones | string | string[]? | Vehicle/ped bone(s); each becomes its own marker at that bone. |
offset | vector3? | Marker position as a fraction of the model's size (0-1 per axis). |
offsetAbsolute | boolean? | offset is in metres from the entity instead. |
Requirements
| Field | Type | |
|---|---|---|
groups | string | string[] | table<string, number>? | Job or gang, optionally with a minimum grade: { police = 2 }. |
items | string | string[] | table<string, number>? | Items needed, optionally with counts. |
anyItem | boolean? | One of items is enough. |
canInteract | fun(entity, distance, coords, name, bone): boolean? | Return false to hide the option. Checked again at the moment of selecting. |
When groups or items fail, the option is shown greyed out with the reason ("Requires item:
Lockpick") and refuses to run. Turn off Show locked options in /interactAdmin to hide them
instead, as ox_target does. canInteract failing always hides it.
Actions
Use one:
| Field | |
|---|---|
onSelect | fun(data) called with the callback data. |
event | Client event, triggered with the data. |
serverEvent | Server event, triggered with the data (entity as a network id). |
command | Command, executed with no arguments. |
export | 'resource.function', called with the data. |
| Field | Type | |
|---|---|---|
hold | number? | new Milliseconds the player must hold to confirm; a ring fills meanwhile. |
Submenus
openMenu turns an option into a submenu; options with a matching menuName live inside it.
Submenus nest, and right click / Backspace goes back a level.
{
{ label = 'Repair', icon = 'tool', openMenu = 'repair' },
{ label = 'Fix Engine', icon = 'engine', menuName = 'repair', onSelect = fixEngine },
{ label = 'Fix Body', icon = 'car-crash', menuName = 'repair', onSelect = fixBody },
{ label = 'Search', icon = 'search', onSelect = search },
}Icons
Any of these work, so existing scripts keep their icons:
| You write | Shows |
|---|---|
'car', 'ti ti-car' | Tabler, rw_interact's own set |
'fa-solid fa-car', 'fas fa-car', 'fab fa-discord' | FontAwesome, as ox_target, qb-target and ox_lib use |
'mdi:car', 'ph:car-bold' | Any Iconify icon |
A bare name is tried as Tabler first, then FontAwesome 6, then FontAwesome 5, so ox_lib-style
icon = 'car' and older FontAwesome names both resolve.