mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-01 14:38:50 +00:00
expand ox_target information
This commit is contained in:
1 parent
e496a87c9f
commit
c75bd8b80f
7 files changed
+225
-250
No files matched your search
@@ -0,0 +1,187 @@
|
||||
## disableTargeting
|
||||
|
||||
Toggle the availability of the targeting menu.
|
||||
|
||||
```lua
|
||||
exports.ox_target:disableTargeting(state)
|
||||
```
|
||||
|
||||
- state: `boolean`
|
||||
|
||||
## addGlobalObject
|
||||
|
||||
Creates new targetable options for all Object entity types.
|
||||
|
||||
```lua
|
||||
exports.ox_target:addGlobalObject(options)
|
||||
```
|
||||
|
||||
## removeGlobalObject
|
||||
|
||||
Removes all options from the global Object list with the option names.
|
||||
|
||||
```lua
|
||||
exports.ox_target:removeGlobalObject(optionNames)
|
||||
```
|
||||
|
||||
- optionNames: `string` or `string[]`
|
||||
|
||||
## addGlobalPed
|
||||
|
||||
Creates new targetable options for all Ped entity types (excluding players).
|
||||
|
||||
```lua
|
||||
exports.ox_target:addGlobalPed(options)
|
||||
```
|
||||
|
||||
## removeGlobalPed
|
||||
|
||||
Removes all options from the global Ped list with the option names.
|
||||
|
||||
```lua
|
||||
exports.ox_target:removeGlobalPed(optionNames)
|
||||
```
|
||||
|
||||
- optionNames: `string` or `string[]`
|
||||
|
||||
## addGlobalPlayer
|
||||
|
||||
Creates new targetable options for all Player entities.
|
||||
|
||||
```lua
|
||||
exports.ox_target:addGlobalPlayer(options)
|
||||
```
|
||||
|
||||
## removeGlobalPlayer
|
||||
|
||||
Removes all options from the global Ped list with the option names.
|
||||
|
||||
```lua
|
||||
exports.ox_target:removeGlobalPlayer(optionNames)
|
||||
```
|
||||
|
||||
- optionNames: `string` or `string[]`
|
||||
|
||||
## addGlobalVehicle
|
||||
|
||||
Creates new targetable options for all Vehicle entity types.
|
||||
|
||||
```lua
|
||||
exports.ox_target:addGlobalVehicle(options)
|
||||
```
|
||||
|
||||
## removeGlobalVehicle
|
||||
|
||||
Removes all options from the global Vehicle list with the option names.
|
||||
|
||||
```lua
|
||||
exports.ox_target:removeGlobalVehicle(optionNames)
|
||||
```
|
||||
|
||||
- optionNames: `string` or `string[]`
|
||||
|
||||
## addModel
|
||||
|
||||
Creates new targetable options for a specific model or list of models.
|
||||
|
||||
```lua
|
||||
exports.ox_target:addModel(models, options)
|
||||
```
|
||||
|
||||
- models: `number` or `number[]`
|
||||
|
||||
## removeModel
|
||||
|
||||
Removes all options from the models list with the option names.
|
||||
|
||||
```lua
|
||||
exports.ox_target:removeModel(models, optionNames)
|
||||
```
|
||||
|
||||
- models: `number` or `number[]`
|
||||
- optionNames: `string` or `string[]`
|
||||
|
||||
## addEntity
|
||||
|
||||
Creates new targetable options for a specific network id (see [NetworkGetNetworkIdFromEntity](https://docs.fivem.net/natives/?_0x9E35DAB6)).
|
||||
|
||||
```lua
|
||||
exports.ox_target:addEntity(netIds, options)
|
||||
```
|
||||
|
||||
- netIds: `number` or `number[]`
|
||||
|
||||
## removeEntity
|
||||
|
||||
Removes all options from the networked entities list with the option names.
|
||||
|
||||
```lua
|
||||
exports.ox_target:removeEntity(netIds, optionNames)
|
||||
```
|
||||
|
||||
- netIds: `number` or `number[]`
|
||||
- optionNames: `string` or `string[]`
|
||||
|
||||
## addLocalEntity
|
||||
|
||||
Creates new targetable options for a specific entity or list of entities.
|
||||
|
||||
```lua
|
||||
exports.ox_target:addLocalEntity(entities, options)
|
||||
```
|
||||
|
||||
- entities: `number` or `number[]`
|
||||
|
||||
## removeLocalEntity
|
||||
|
||||
Removes all options from the entities list with the option names.
|
||||
|
||||
```lua
|
||||
exports.ox_target:removeLocalEntity(entities, optionNames)
|
||||
```
|
||||
|
||||
- entities: `number` or `number[]`
|
||||
- optionNames: `string` or `string[]`
|
||||
|
||||
## addSphereZone
|
||||
|
||||
Creates a new targetable [sphere zone](../../ox_lib/Modules/Zones/Shared#libzonessphere).
|
||||
|
||||
```lua
|
||||
exports.ox_target:addSphereZone(parameters)
|
||||
```
|
||||
|
||||
- parameters: `table`
|
||||
- coords: `vector`
|
||||
- radius: `number`
|
||||
- debug?: `boolean`
|
||||
- drawSprite?: `boolean`
|
||||
- options: `table`
|
||||
|
||||
**Returns:** `number`
|
||||
|
||||
## addBoxZone
|
||||
|
||||
Creates a new targetable [box zone](../../ox_lib/Modules/Zones/Shared#libzonesbox).
|
||||
|
||||
```lua
|
||||
exports.ox_target:addBoxZone(parameters)
|
||||
```
|
||||
|
||||
- parameters: `table`
|
||||
- coords: `vector`
|
||||
- size: `vector3`
|
||||
- rotation: `number`
|
||||
- debug?: `boolean`
|
||||
- drawSprite?: `boolean`
|
||||
- options: `table`
|
||||
|
||||
**Returns:** `number`
|
||||
|
||||
## removeZone
|
||||
|
||||
Removes a targetable zone with the given id (returned by addBoxZone/addSphereZone).
|
||||
|
||||
```lua
|
||||
exports.ox_target:removeZone(id)
|
||||
```
|
||||
@@ -0,0 +1,38 @@
|
||||
When creating a targetable option you must send an array of options with the following properties.
|
||||
|
||||
## Options
|
||||
|
||||
- label: `string`
|
||||
- name?: `string`
|
||||
- An identifier used when removing an option.
|
||||
- icon?: `string`
|
||||
- Name of a [Font Awesome](https://fontawesome.com/icons) icon.
|
||||
- iconColor?: `string`
|
||||
- distance?: `number`
|
||||
- bones?: `string` or `string[]`
|
||||
- A bone name or array of bone names (see [GetEntityBoneIndexByName](https://docs.fivem.net/natives/?_0xFB71170B7E76ACBA)).
|
||||
- groups?: `string` or `string[]` or `table<string, number>`
|
||||
- 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` or `string[]` or `table<string, number>`
|
||||
- An item, array of items, or pairs of items-count required to show the option.
|
||||
- Items are framework dependent.
|
||||
- anyItem?: `boolean`
|
||||
- Only require a single item from the items table to exist.
|
||||
- canInteract?: `function(entity, distance, coords, name, bone)`
|
||||
- Options will always display if this is undefined.
|
||||
- onSelect?: `function(data)`
|
||||
- export?: `string`
|
||||
- event?: `string`
|
||||
- serverEvent?: `string`
|
||||
- command?: `string`
|
||||
|
||||
## Option effect
|
||||
|
||||
When selecting an option it will trigger a single action, in order of priority:
|
||||
|
||||
1. onSelect function
|
||||
2. export
|
||||
3. event
|
||||
4. server event
|
||||
5. command
|
||||
@@ -1,26 +0,0 @@
|
||||
# Usage
|
||||
|
||||
When calling exports to add options, the input is an array of tables with the following properties.
|
||||
|
||||
- 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<string, number>`
|
||||
- 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<string, number>`
|
||||
- An item, array of items, or pairs of items-count required to show the option.
|
||||
- Items are framework dependent.
|
||||
- anyItem?: `boolean`
|
||||
- Only require a single item from the items table to exist.
|
||||
- canInteract?: `function(entity, distance, coords, name, bone)`
|
||||
- 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`
|
||||
@@ -1,55 +0,0 @@
|
||||
---
|
||||
keywords:
|
||||
[
|
||||
'addGlobalObject',
|
||||
'addGlobalPed',
|
||||
'addGlobalPlayer',
|
||||
'addGlobalVehicle',
|
||||
'removeGlobalObject',
|
||||
'removeGlobalPed',
|
||||
'removeGlobalPlayer',
|
||||
'removeGlobalVehicle',
|
||||
]
|
||||
---
|
||||
|
||||
Registers options that will apply to all entities of that type (object, ped, player, vehicle).
|
||||
|
||||
```lua
|
||||
local options = {
|
||||
{
|
||||
name = 'ox:option1',
|
||||
event = 'ox_target:debug',
|
||||
icon = 'fa-solid fa-road',
|
||||
label = 'Option 1',
|
||||
},
|
||||
{
|
||||
name = 'ox:option2',
|
||||
event = 'ox_target:debug',
|
||||
icon = 'fa-solid fa-road',
|
||||
label = 'Option 2',
|
||||
canInteract = function(entity, distance, coords, name, bone)
|
||||
return not IsEntityDead(entity)
|
||||
end
|
||||
}
|
||||
}
|
||||
|
||||
local optionNames = { 'ox:option1', 'ox:option2' }
|
||||
```
|
||||
|
||||
## Create Globals
|
||||
|
||||
```lua
|
||||
exports.ox_target:addGlobalObject(options)
|
||||
exports.ox_target:addGlobalPed(options)
|
||||
exports.ox_target:addGlobalPlayer(options)
|
||||
exports.ox_target:addGlobalVehicle(options)
|
||||
```
|
||||
|
||||
## Remove Globals
|
||||
|
||||
```lua
|
||||
exports.ox_target:removeGlobalObject(optionNames)
|
||||
exports.ox_target:removeGlobalPed(optionNames)
|
||||
exports.ox_target:removeGlobalPlayer(optionNames)
|
||||
exports.ox_target:removeGlobalVehicle(optionNames)
|
||||
```
|
||||
@@ -1,80 +0,0 @@
|
||||
```lua
|
||||
local options = {
|
||||
{
|
||||
name = 'ox:option1',
|
||||
event = 'ox_target:debug',
|
||||
icon = 'fa-solid fa-road',
|
||||
label = 'Option 1',
|
||||
},
|
||||
{
|
||||
name = 'ox:option2',
|
||||
event = 'ox_target:debug',
|
||||
icon = 'fa-solid fa-road',
|
||||
label = 'Option 2',
|
||||
canInteract = function(entity, distance, coords, name, bone)
|
||||
return not IsEntityDead(entity)
|
||||
end
|
||||
}
|
||||
}
|
||||
|
||||
local models = { `prop_atm_01`, `prop_atm_02` }
|
||||
local optionsNames = { 'ox:option1', 'ox:option2' }
|
||||
```
|
||||
|
||||
## disableTargeting
|
||||
|
||||
Toggles the state on being able to target. true/false
|
||||
|
||||
```lua
|
||||
exports.ox_target:disableTargeting(state)
|
||||
```
|
||||
|
||||
## addModel
|
||||
|
||||
Add new options when targeting a specific model or list of models.
|
||||
|
||||
```lua
|
||||
exports.ox_target:addModel(models, options)
|
||||
```
|
||||
|
||||
## removeModel
|
||||
|
||||
Remove options from a specific model or list of models.
|
||||
|
||||
```lua
|
||||
exports.ox_target:removeModel(models, optionNames)
|
||||
```
|
||||
|
||||
## addEntity
|
||||
|
||||
Add new options when targeting a networked entity matching the given netid or list of netIds.
|
||||
Requires the use of [NetworkGetNetworkIdFromEntity](https://docs.fivem.net/natives/?_0x9E35DAB6) on an entity id.
|
||||
|
||||
```lua
|
||||
exports.ox_target:addEntity(netIds, options)
|
||||
```
|
||||
|
||||
## removeEntity
|
||||
|
||||
Remove options from a networked entity matching the given netid or list of netIds.
|
||||
Requires the use of [NetworkGetNetworkIdFromEntity](https://docs.fivem.net/natives/?_0x9E35DAB6) on an entity id.
|
||||
|
||||
```lua
|
||||
exports.ox_target:removeEntity(netIds, optionNames)
|
||||
```
|
||||
|
||||
## addLocalEntity
|
||||
|
||||
Add new options when targeting a local entity or list of entities.
|
||||
|
||||
```lua
|
||||
exports.ox_target:addLocalEntity(entities, options)
|
||||
```
|
||||
|
||||
## removeLocalEntity
|
||||
|
||||
Remove options from a local entity or list of entities.
|
||||
|
||||
```lua
|
||||
exports.ox_target:removeLocalEntity(entities, optionNames)
|
||||
```
|
||||
@@ -1,83 +0,0 @@
|
||||
The input for zones differs slightly from all other options, instead taking the [zone](../../ox_lib/Modules/Zones/Shared.md) properties and two additional properties (drawSprite, and options).
|
||||
|
||||
## addSphereZone
|
||||
|
||||
```lua
|
||||
exports.ox_target:addSphereZone(parameters)
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
```lua
|
||||
{
|
||||
coords = vector3,
|
||||
radius = number,
|
||||
debug? = boolean,
|
||||
drawSprite? = boolean,
|
||||
options = options,
|
||||
}
|
||||
```
|
||||
|
||||
### Example
|
||||
|
||||
```lua
|
||||
exports.ox_target:addSphereZone({
|
||||
coords = vec3(440.5363, -1015.666, 28.85637),
|
||||
radius = 1,
|
||||
debug = drawZones,
|
||||
options = {
|
||||
{
|
||||
name = 'sphere',
|
||||
event = 'ox_target:debug',
|
||||
icon = 'fa-solid fa-circle',
|
||||
label = '(Debug) Sphere',
|
||||
}
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
## addBoxZone
|
||||
|
||||
```lua
|
||||
exports.ox_target:addBoxZone(parameters)
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
```lua
|
||||
{
|
||||
coords = vector3,
|
||||
size = vector3,
|
||||
rotation = number,
|
||||
debug? = boolean,
|
||||
drawSprite? = boolean,
|
||||
options = options,
|
||||
}
|
||||
```
|
||||
|
||||
### Example
|
||||
|
||||
```lua
|
||||
exports.ox_target:addBoxZone({
|
||||
coords = vec3(442.5363, -1017.666, 28.85637),
|
||||
size = vec3(2, 2, 2),
|
||||
rotation = 45,
|
||||
debug = drawZones,
|
||||
options = {
|
||||
{
|
||||
name = 'box',
|
||||
event = 'ox_target:debug',
|
||||
icon = 'fa-solid fa-cube',
|
||||
label = '(Debug) Box',
|
||||
}
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
## removeZone
|
||||
|
||||
```lua
|
||||
exports.ox_target:removeZone(id)
|
||||
```
|
||||
|
||||
The `id` passed to removeZone is the return value from addBoxZone / addSphereZone.
|
||||
@@ -1,6 +0,0 @@
|
||||
label: Ox Target
|
||||
collapsible: true
|
||||
collapsed: true
|
||||
link:
|
||||
type: generated-index
|
||||
description: A performant and flexible standalone targeting resource or "third-eye", with additional functionality for ox_inventory, ox_core, qb-core, and es_extended.
|
||||
Reference in new issue
Block a user