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
This commit is contained in:
Linden committed 2023-02-08 20:13:48 +11:00
1 parent b7d3f66a9d
commit adf219226d
3 files changed
+19 -36

No files matched your search

+1 -4
View File
@@ -5,9 +5,6 @@ local options = {
event = 'ox_target:debug', event = 'ox_target:debug',
icon = 'fa-solid fa-road', icon = 'fa-solid fa-road',
label = 'Option 1', label = 'Option 1',
canInteract = function(entity, distance, coords, name, bone)
return math.random(0, 100) < 51
end
}, },
{ {
name = 'ox:option2', name = 'ox:option2',
@@ -15,7 +12,7 @@ local options = {
icon = 'fa-solid fa-road', icon = 'fa-solid fa-road',
label = 'Option 2', label = 'Option 2',
canInteract = function(entity, distance, coords, name, bone) canInteract = function(entity, distance, coords, name, bone)
return math.random(0, 100) < 51 return entity and not IsEntityDead(entity)
end end
} }
} }
-6
View File
@@ -31,9 +31,6 @@ exports.ox_target:addSphereZone({
event = 'ox_target:debug', event = 'ox_target:debug',
icon = 'fa-solid fa-circle', icon = 'fa-solid fa-circle',
label = '(Debug) Sphere', label = '(Debug) Sphere',
canInteract = function(entity, distance, coords, name)
return true
end
} }
} }
}) })
@@ -72,9 +69,6 @@ exports.ox_target:addBoxZone({
event = 'ox_target:debug', event = 'ox_target:debug',
icon = 'fa-solid fa-cube', icon = 'fa-solid fa-cube',
label = '(Debug) Box', label = '(Debug) Box',
canInteract = function(entity, distance, coords, name)
return true
end
} }
} }
}) })
+18 -26
View File
@@ -2,29 +2,21 @@
When calling exports to add options, the input is an array of tables with the following properties. When calling exports to add options, the input is an array of tables with the following properties.
```lua - label: `string` Display text.
{ - name?: `string` Used as an identifier to remove the option.
-- an identifier used when removing options - icon?: `string` Name of a [Font Awesome](https://fontawesome.com/icons) icon.
name? = string, - iconColor?: `string`
-- an icon from font-awesome - distance?: `number`
icon? = string, - bones?: `string` | `string[]` A bone name or array of bone names.
-- display text - Refer to [GetEntityBoneIndexByName](https://docs.fivem.net/natives/?_0xFB71170B7E76ACBA).
label = string, - groups?: `string` | `string[]` | `table<string, number>` A group, array of groups, or pairs of groups-grades required to show the option.
-- range to display (default: 2, max: 7) - Groups are framework dependent, and may refer to jobs, gangs, etc.
distance? = number, - items?: `string` | `string[]` | `table<string, number`>` An item, array of items, or pairs of items-count required to show the option.
-- a group, array of groups, or groups and grades needed to display - Items are framework dependent.
groups? = string | string[] | { [string]: number } - canInteract?: `function(entity, distance, coords, name, bone)` Check if the option should display or be hidden.
-- an item, array of items, or items and counts needed to display - Do not use this function to "return true". Options will always display if this is undefined.
items? = string | string[] | { [string]: number } - onSelect?: `function(data)`
-- a bone, bones table to select specific parts - export?: `string`
bones? = string | string[] -> example : 'bonnet' || { 'bonnet', 'boot' } - event?: `string`
-- custom check to hide or display the option - serverEvent?: `string`
canInteract? = function(entity, distance, coords, name, bone), - command?: `string`
-- triggered on option selection (one only)
onSelect? = function(data),
export? = string,
event? = string,
serverEvent? = string,
command? = string
}
```