MrPoulpi Labs
ox_target

Available scripts

FR
Documentation centre

Quick start

Get a working ox_target menu with the shipped configuration, then edit and add your first interaction in config_interactions.lua.

Goal: check that the menu works with the shipped configuration, then customise an option. File to edit: config_interactions.lua (loaded client side only).

1. Start from the shipped configuration

The archive works unchanged: the Config.*Script selectors are 'auto' (except NotifyScript and InputScript, set to 'ox_lib'). Start the server, hold Alt and target yourself: you should see Mon ID, Faire un /me, Emotes, Anti-coups de poing and Débugger personnage — the shipped labels are in French and can be changed freely. The Dev Tools and Admin categories only appear when your groups grant access (see Permissions).

2. Rename an existing option

In config_interactions.lua, find the Config.SelfInteractions list and change the label of the my_id option:

{ name = 'my_id', label = 'Show my ID', icon = 'fa-solid fa-id-card', description = 'Display your server ID', builtin = 'show_my_id' },

Keep the same name: it identifies the option in its list. Restart the resource with restart ox_target and reopen the menu.

3. Add an emote to the Emotes submenu

Add this line to Config.SelfInteractions, after the other emotes:

{ name = 'emote_dance', menu = 'self_emotes', label = 'Dance', icon = 'fa-solid fa-music', type = 'emote', emote = 'dance' },
  • menu = 'self_emotes' places the option in the submenu opened by the self_emotes category.
  • type = 'emote' calls Bridge.PlayEmote('dance'): with rpemotes-reborn started, the EmoteCommandStart export; otherwise the Config.Commands.emote command (e dance).

Expected result: after restart ox_target, the Emotes category contains Dance; a click plays the emote and closes the menu.

4. Add an interaction that calls your script

To trigger a client event of one of your resources when targeting a player, add to Config.PlayerInteractions:

{ name = 'give_card', label = 'Give my business card', icon = 'fa-solid fa-address-card', type = 'client_event', event = 'my_script:giveCard' },

my_script:giveCard is an example name: replace it with the real event of your resource. It receives the target object described in Interactions:

AddEventHandler('my_script:giveCard', function(target)
    TriggerServerEvent('my_script:card', target.serverId)
end)

Faster with the configurator

The configurator starts from the archive’s exact values, previews the menu and exports the Lua files. It sends nothing to your server: you copy the generated files and restart the resource.

Common mistakes

  • Missing comma between two list entries: Lua syntax error in F8, no option is shown.
  • menu matching no category: the option never appears. The value must equal the opens of a category in the same list.
  • Two options with the same name in a list: the engine prints a warning in F8. Use unique names.

Search

Type a term: setting, export, error…