MrPoulpi Labs
ox_target

Available scripts

FR
Documentation centre

Interactions

config_interactions.lua option format — player, self, vehicle, ped, object, model and zone lists, common fields, action types, target object and built-ins.

Goal: write and understand every menu option. File to edit: config_interactions.lua (client side). Restart the resource after a change: options are built once, at start.

The lists

List Target Default distance
Config.PlayerInteractions other players Distances.player
Config.SelfInteractions your own character no effect
Config.VehicleInteractions every vehicle Distances.vehicle
Config.PedInteractions every ped Distances.ped
Config.ObjectInteractions every object Distances.object
Config.ModelInteractions specific models Distances.default
Config.ZoneInteractions box or sphere zones Distances.default

A list’s options are shown in file order. On a vehicle, the original ox_target options (doors, hood, trunk) appear before those of VehicleInteractions, followed by model options and zone options.

Common fields

Field Type Role
name string, required Unique identifier within its list. An option without name is ignored.
label string Displayed text; defaults to name.
icon string Font Awesome classes, e.g. 'fa-solid fa-star'. The NUI loads Font Awesome Free from a CDN, without a pinned version.
iconColor string CSS colour of the icon.
description string Text shown under the menu on hover.
menu string Submenu the option appears in (a category’s opens).
separatorAfter boolean Separator line after the option.
distance number Max distance in metres (see table above).
enabled false or function false: option not created. Function evaluated once at start; an error or a false return disables the option.
permission string Config.Permissions key, or 'everyone', 'staff', 'admin'. An unknown key always hides the option.
jobs table or string { 'police' }, { police = 2 } (minimum grade) or 'police'. Display only.
groups, items, anyItem — Native ox_target filters (framework groups, owned items).
bones, offset, absoluteOffset, offsetSize — Targeting a bone or a precise position of the entity (native fields).
canInteract function function(entity, distance, coords, name, bone) → boolean, evaluated on every refresh.

Action types

An option declares its action with onSelect, a type or a builtin. When onSelect is present, it takes priority.

Declaration Effect
onSelect = function(target) … end Your Lua code, receives the target object.
type = 'category', opens = 'my_menu' Opens a submenu; opens defaults to name.
type = 'emote', emote = 'wave' Bridge.PlayEmote('wave').
type = 'shared_emote', emote = 'hug' Bridge.PlaySharedEmote('hug', target.serverId); meant for players.
type = 'client_event', event = 'res:event' TriggerEvent(event, target, …args).
type = 'server_event', event = 'res:event' TriggerServerEvent(event, payload, …args) — unsecured.
type = 'server_action', action = 'name' Secured action from Config.ServerActions; args can be a table or function(target).
type = 'export', resource = 'res', export = 'Fn' exports.res:Fn(target).
type = 'command', command = 'cmd {id}' ExecuteCommand; {id} is replaced by the targeted server ID (empty outside players).
type = 'checkbox', default = false Remembered checkbox; see Categories and checkboxes.
builtin = 'name' Built-in feature (see below).

For client_event and server_event, an args = { … } field adds arguments after the passed object. For server_event, the passed object is { serverId, netId, coords, name, kind }.

Target object

onSelect callbacks, client_event events, exports and the args function of a server_action receive:

Field Content
entity Handle of the targeted entity (your ped for Self).
coords, distance Aimed point and distance at click time.
zone Zone identifier, for zone options.
kind 'player', 'self', 'vehicle', 'ped', 'object', 'model' or 'zone'.
name The option’s name.
isSelf true for the Self list.
serverId Server ID of the targeted player (yours for Self).
netId Network ID when the entity is networked.
model, entityType Model and entity type (except Self).
plate Plate, for a vehicle.
{
    name = 'check_plate', label = 'Read the plate', icon = 'fa-solid fa-id-card',
    onSelect = function(target)
        print(target.kind, target.plate, target.netId)
    end
},

Builtins

Built-ins are integrated features. Each one is only accepted in some lists: elsewhere, the engine ignores it with a warning. Sensitive built-ins keep their server permission even if you remove the permission field from the entry.

Built-in Lists Feature / Permission Effect
copy_id Players Features.copyId Copies the targeted player’s server ID to the clipboard.
Server check: No server action: runs client side only.
show_player_id Players Features.showPlayerId Shows the targeted player’s server ID.
Server check: No server action: runs client side only.
copy_emote Players Features.copyEmote Asks the targeted player for the current emote and plays it.
Server check: Player distance, 1.5 s cooldown; the reply must have been requested and arrive within 5 s.
rps_challenge Players Features.rps Challenges the player to Rock Paper Scissors.
Server check: rps feature, Distances.rps + tolerance, players not busy, RPS.inviteTimeout expiry.
send_bill Players Features.billing Opens the invoice form and sends it to the billing script.
Server check: No engine server action: validation depends on the billing script.
admin_revive Players Features.medical
Permissions.revive
Revives the targeted player.
Server check: revive permission, medical feature, medical script available, Distances.player, 1 s cooldown.
admin_heal Players Features.medical
Permissions.heal
Heals the targeted player.
Server check: heal permission, medical feature, Distances.player, 1 s cooldown.
force_emote Players Features.forceActions
Permissions.forceEmote
Makes the targeted player play a typed emote.
Server check: forceEmote permission, distance, name validated by Config.Emotes.
force_me Players Features.forceActions
Permissions.forceMe
Makes the targeted player send a typed /me.
Server check: forceMe permission, distance, 1–120 character text, control characters replaced.
show_my_id Self — Shows your server ID.
Server check: No server action: runs client side only.
me_input Self — Types a /me then calls Bridge.Me.
Server check: No server action: runs client side only.
anti_punch Self Features.antiPunch Remembered checkbox that blocks unarmed punches.
Server check: No server action: runs client side only.
self_revive Self Features.medical
Permissions.selfRevive
Revives your character according to Config.Medical.selfMode.
Server check: selfRevive permission, medical feature, 2 s cooldown.
self_heal Self Features.medical
Permissions.selfHeal
Heals your character according to Config.Medical.selfMode.
Server check: selfHeal permission, medical feature, 2 s cooldown.
weather_menu all Features.weather
Permissions.weather
Generates the whole weather submenu from Config.Weather.
Server check: weather permission, weather script available, values limited to Config.Weather, 0.5 s cooldown (3 s for random).
dev_copy_coords Self Features.devTools
Permissions.devTools
Copies vector3(x, y, z) of your position.
Server check: No server action: runs client side only.
dev_copy_coords_heading Self Features.devTools
Permissions.devTools
Copies vector4(x, y, z, h).
Server check: No server action: runs client side only.
dev_restore_appearance Self Features.devTools
Permissions.devTools
Reloads your appearance through the appearance script.
Server check: No server action: runs client side only.
slash_tyre Vehicles Features.slashTyre Slashes the closest tyre with a blade.
Server check: Distances.slashTyre, tyre index 0–7, held weapon checked, 2.5 s cooldown.
Only visible when the player is not in a vehicle and a weapon from Config.Vehicles.slashTyre.weapons is held.
hide_in_trunk Vehicles Features.trunk Hides the player in the trunk.
Server check: Server reservation: one occupant per vehicle, Distances.trunk + tolerance + 2 m.
Only visible when the player is not in a vehicle and trunk unlocked, close and free, vehicle not destroyed and not excluded.
lockpick_vehicle Vehicles Features.lockpick Lockpicks the vehicle (progress bar or hook).
Server check: Config.Vehicles.lockpick jobs and item, Distances.vehicle, 3 s cooldown.
Only visible when the player is not in a vehicle.
repair_vehicle Vehicles Features.repair Repairs the vehicle through the preset or hook.
Server check: Config.Vehicles.repair jobs and item, optional item removal, Distances.vehicle, 3 s cooldown.
Only visible when the player is not in a vehicle.
give_keys Vehicles Features.giveKeys
Permissions.giveKeys
Gives you the vehicle keys.
Server check: giveKeys permission, Distances.vehicle, 1 s cooldown.
dev_copy_vehicle_name Vehicles Features.devTools
Permissions.devTools
Copies the model display name.
Server check: No server action: runs client side only.
dev_copy_plate Vehicles Features.devTools
Permissions.devTools
Copies the plate.
Server check: No server action: runs client side only.
dev_delete_entity Vehicles, Peds, Objects Features.devTools
Permissions.devTools
Deletes the targeted entity (never a player).
Server check: devTools permission, Distances.devTools; local entities are deleted on every client within ±1.5 m.
Only visible when the target is not a player.
dev_copy_ped_model Peds Features.devTools
Permissions.devTools
Copies the ped model hash.
Server check: No server action: runs client side only.
dev_clone_ped Peds Features.devTools
Permissions.devTools
Applies the ped model to your player.
Server check: No server action: runs client side only.
dev_copy_prop_name Objects Features.devTools
Permissions.devTools
Copies the prop archetype name.
Server check: No server action: runs client side only.
dev_copy_prop_full Objects Features.devTools
Permissions.devTools
Copies the prop name, vector3 and heading.
Server check: No server action: runs client side only.
dev_scan_props Objects Features.devTools
Permissions.devTools
Lists props within Config.DevTools.scanRadius in F8.
Server check: No server action: runs client side only.

In the Models and Zones lists, only weather_menu is accepted: the other built-ins declare specific lists that do not include these two types.

Models

Config.ModelInteractions = {
    {
        models = { 'prop_atm_01', 'prop_atm_02' },
        options = {
            { name = 'atm_use', label = 'Use the ATM', icon = 'fa-solid fa-money-bill', type = 'client_event', event = 'my_bank:openAtm' },
        },
    },
}

my_bank:openAtm is an example name. models accepts names or hashes. Model options enable the outline (ox_target:drawOutline) on those objects.

Zones

Config.ZoneInteractions = {
    {
        shape = 'box', name = 'pd_duty', coords = vec3(441.0, -981.0, 30.7), size = vec3(1.5, 1.5, 2.0), rotation = 0,
        options = {
            { name = 'pd_duty', label = 'Go on duty', icon = 'fa-solid fa-clipboard', jobs = { 'police' }, type = 'server_event', event = 'my_pd:duty' },
        },
    },
    {
        shape = 'sphere', coords = vec3(-1037.5, -2737.8, 20.2), radius = 1.2,
        options = {
            { name = 'info_desk', label = 'Front desk', icon = 'fa-solid fa-circle-info', type = 'command', command = 'help' },
        },
    },
}

Fields read by the registry: shape, coords, size, radius, rotation, debug, drawSprite, name and options. Only 'box' and 'sphere' are supported: any other shape value is treated as a box. Polygon zones exist through the addPolyZone export (see API) but not through Config.ZoneInteractions.

Simplified format and native format

config_interactions.lua uses a simplified format, translated by the engine into ox_target’s native format:

Simplified format Native format produced
menu menuName
type = 'category', opens isCategory = true, openMenu
type = 'checkbox', default isCheckbox = true, checked
distance absent distance resolved from Config.Distances
permission, jobs, enabled combined canInteract condition
actions (type, builtin) internal onSelect

In your own resources, ox_target exports (addGlobalVehicle, addModel…) expect the native format: menuName and openMenu, not menu and opens. The type, builtin, permission and jobs fields do not exist there.

Common mistakes

  • Invisible option: permission missing from Config.Permissions, menu without a matching category, or feature disabled.
  • Built-in in the wrong list: F8 shows a warning that the built-in cannot be used in that list.
  • enabled = function() depending on the player: evaluated at start, before the character is loaded. Use canInteract for a dynamic condition.
  • server_event for a sensitive action: the server checks nothing; use a server_action.

Search

Type a term: setting, export, error…