From adf219226db437a8acf844409d54acb7697583d5 Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Wed, 8 Feb 2023 20:13:48 +1100 Subject: [PATCH] update ox_target option properties also remove the canInteract sample code because people copy-paste it like the braindead apes they are without any understanding of what it's actually doing --- docs/ox_target/Usage/Target.md | 5 +--- docs/ox_target/Usage/Zones.md | 6 ----- docs/ox_target/Usage/index.md | 44 ++++++++++++++-------------------- 3 files changed, 19 insertions(+), 36 deletions(-) diff --git a/docs/ox_target/Usage/Target.md b/docs/ox_target/Usage/Target.md index 686126ee..f77168da 100644 --- a/docs/ox_target/Usage/Target.md +++ b/docs/ox_target/Usage/Target.md @@ -5,9 +5,6 @@ local options = { event = 'ox_target:debug', icon = 'fa-solid fa-road', label = 'Option 1', - canInteract = function(entity, distance, coords, name, bone) - return math.random(0, 100) < 51 - end }, { name = 'ox:option2', @@ -15,7 +12,7 @@ local options = { icon = 'fa-solid fa-road', label = 'Option 2', canInteract = function(entity, distance, coords, name, bone) - return math.random(0, 100) < 51 + return entity and not IsEntityDead(entity) end } } diff --git a/docs/ox_target/Usage/Zones.md b/docs/ox_target/Usage/Zones.md index 087f0075..601c1c2a 100644 --- a/docs/ox_target/Usage/Zones.md +++ b/docs/ox_target/Usage/Zones.md @@ -31,9 +31,6 @@ exports.ox_target:addSphereZone({ event = 'ox_target:debug', icon = 'fa-solid fa-circle', label = '(Debug) Sphere', - canInteract = function(entity, distance, coords, name) - return true - end } } }) @@ -72,9 +69,6 @@ exports.ox_target:addBoxZone({ event = 'ox_target:debug', icon = 'fa-solid fa-cube', label = '(Debug) Box', - canInteract = function(entity, distance, coords, name) - return true - end } } }) diff --git a/docs/ox_target/Usage/index.md b/docs/ox_target/Usage/index.md index bbc2d6d5..0da3cd81 100644 --- a/docs/ox_target/Usage/index.md +++ b/docs/ox_target/Usage/index.md @@ -2,29 +2,21 @@ When calling exports to add options, the input is an array of tables with the following properties. -```lua -{ - -- an identifier used when removing options - name? = string, - -- an icon from font-awesome - icon? = string, - -- display text - label = string, - -- range to display (default: 2, max: 7) - distance? = number, - -- a group, array of groups, or groups and grades needed to display - groups? = string | string[] | { [string]: number } - -- an item, array of items, or items and counts needed to display - items? = string | string[] | { [string]: number } - -- a bone, bones table to select specific parts - bones? = string | string[] -> example : 'bonnet' || { 'bonnet', 'boot' } - -- custom check to hide or display the option - canInteract? = function(entity, distance, coords, name, bone), - -- triggered on option selection (one only) - onSelect? = function(data), - export? = string, - event? = string, - serverEvent? = string, - command? = string -} -``` +- label: `string` Display text. +- name?: `string` Used as an identifier to remove the option. +- icon?: `string` Name of a [Font Awesome](https://fontawesome.com/icons) icon. +- iconColor?: `string` +- distance?: `number` +- bones?: `string` | `string[]` A bone name or array of bone names. + - Refer to [GetEntityBoneIndexByName](https://docs.fivem.net/natives/?_0xFB71170B7E76ACBA). +- groups?: `string` | `string[]` | `table` A group, array of groups, or pairs of groups-grades required to show the option. + - Groups are framework dependent, and may refer to jobs, gangs, etc. +- items?: `string` | `string[]` | `table` An item, array of items, or pairs of items-count required to show the option. + - Items are framework dependent. +- canInteract?: `function(entity, distance, coords, name, bone)` Check if the option should display or be hidden. + - Do not use this function to "return true". Options will always display if this is undefined. +- onSelect?: `function(data)` +- export?: `string` +- event?: `string` +- serverEvent?: `string` +- command?: `string`