chore: target, fuel, and doorlock updates (#136)

* chore: ox_target cleaned up

- minor fixes on ox_lib zones

* chore: move get/set fuel amount to shared.mdx file

* chore: Update removeZone input type

https://github.com/overextended/ox_target/commit/021b32d4d52fa58305045177f3dc3c0a969d07e5

* chore: doorlock cleaned up

* add missing export

* reorder textui sections
This commit is contained in:
Jag authored and GitHub committed 2023-07-27 11:45:12 +02:00
1 parent fc2622ad2b
commit de4051e62a
7 files changed
+96 -48

No files matched your search

+6 -5
View File
@@ -9,15 +9,16 @@ These events are safe to trigger and handle in other scripts.
Can be triggered to lock or unlock a door.
```
TriggerEvent('ox_doorlock:setState', doorId, state)
TriggerEvent('ox_doorlock:setState', doorId, state, lockpick)
```
- doorId: `number`
- state: `0` or `1`
- state: `0` or `1` or `boolean`
- lockpick: `boolean`
## Handlers
These events shouldn't be triggered by any other scripts.
These events **should not** be triggered by any other scripts.
### ox_doorlock:stateChanged
@@ -29,5 +30,5 @@ AddEventHandler('ox_doorlock:stateChanged', function(source, doorId, state, used
- source: `number` or `nil`
- doorId: `number`
- state: `0` or `1`
- usedItem: `string` or `false`
- state: `boolean`
- usedItem: `string` or `false` or `nil`
+15 -8
View File
@@ -8,15 +8,13 @@ Gets data for a door with the given id, matching the id for the database entry.
exports.ox_doorlock:getDoor(id)
```
### Parameters
Gets data for a door with the given `id`, matching the id for the database entry.
- id: `number`
### Returns
Return:
- `table`
Gets data for a door with the given name, matching the name for the database entry.
- door: `table`
## getDoorFromName
@@ -24,10 +22,19 @@ Gets data for a door with the given name, matching the name for the database ent
exports.ox_doorlock:getDoorFromName(name)
```
### Parameters
Gets data for a door with the given `name`, matching the name for the database entry.
- name: `string`
### Returns
Return:
- `table`
- door: `table`
## editDoor
```lua
exports.ox_doorlock:editDoor(id, data)
```
- id: `number`
- data: `table`
+16 -3
View File
@@ -26,6 +26,8 @@ title: Door Settings
- Door can be lockpicked when interacting with a targeting resource.
- Hide UI
- No indicators (i.e. icon, text) will display on the door.
- Hold Open
- Holds the door open while unlocked.
## Characters
@@ -44,13 +46,24 @@ title: Door Settings
- Item
- Name of the item.
- Metadata type
- Requires metadata support (i.e. ox_inventory) to check slot.metadata.type
- Requires metadata support (i.e. ox_inventory) to check slot.metadata.type.
- Remove on use
- Removes the item after interacting with the door.
## Lockpick
- Difficulty
- Sets the skillcheck difficulty (see [docs](../ox_lib/Modules/Interface/Client/skillcheck)).
- Area size
- Custom difficulty area size.
- Custom difficulty area size in degrees.
- Speed multiplier
- Custom difficulty idicator speed.
- Custom difficulty idicator speed multipier.
## Sound
- Lock sound
- Sound to play on door lock.
- Unlock sound
- Sound to play on door unlock.
*Note*: Sounds are stored in the `./web/public/sounds` directory.
-12
View File
@@ -27,15 +27,3 @@ These resources aren't required but provide additional functionality.
- [ox_target](../ox_target/)
</Steps>
## Get vehicle fuel amount
```lua
local fuel = Entity(vehicleId).state.fuel
```
## Set vehicle fuel amount
```lua
Entity(vehicleId).state.fuel = fuelAmount
```
+11
View File
@@ -0,0 +1,11 @@
## Get vehicle fuel amount
```lua
local fuel = Entity(vehicleId).state.fuel
```
## Set vehicle fuel amount
```lua
Entity(vehicleId).state.fuel = fuelAmount
```
+11 -10
View File
@@ -21,9 +21,9 @@ lib.zones.poly(data)
- All z values must match
- thickness?: `number`
- Default: `4`
- onEnter: `function(self: table)`
- onExit: `function(self: table)`
- inside: `function(self: table)`
- onEnter?: `function(self: table)`
- onExit?: `function(self: table)`
- inside?: `function(self: table)`
- debug?: `boolean`
## lib.zones.box
@@ -35,12 +35,13 @@ lib.zones.box(data)
- data: `table`
- coords: `vector3`
- size?: `vector3`
- Default: `vec3(4, 4, 4)`
- Default: `vec3(2, 2, 2)`
- rotation?: `number`
- Angle in degrees
- onEnter: `function(self: table)`
- onExit: `function(self: table)`
- inside: `function(self: table)`
- Default: `0`
- onEnter?: `function(self: table)`
- onExit?: `function(self: table)`
- inside?: `function(self: table)`
- debug?: `boolean`
## lib.zones.sphere
@@ -53,9 +54,9 @@ lib.zones.sphere(data)
- coords: `vector3`
- radius?: `number`
- Default: `2`
- onEnter: `function`(self: `table`)
- onExit: `function`(self: `table`)
- inside: `function`(self: `table`)
- onEnter?: `function(self: table)`
- onExit?: `function(self: table)`
- inside?: `function(self: table)`
- debug?: `boolean`
## Methods
+37 -10
View File
@@ -11,6 +11,7 @@ exports.ox_target:disableTargeting(state)
```
- state: `boolean`
- Setting `state` to `true` will turn off the targeting eye if it is active and prevent it from reopening until `state` is set to `false` again.
## addGlobalObject
@@ -64,7 +65,7 @@ exports.ox_target:addGlobalPlayer(options)
## removeGlobalPlayer
Removes all options from the global Ped list with the option names.
Removes all options from the global Player list with the option names.
```lua
exports.ox_target:removeGlobalPlayer(optionNames)
@@ -100,7 +101,7 @@ Creates new targetable options for a specific model or list of models.
exports.ox_target:addModel(models, options)
```
- models: `number` or `number[]`
- models: `number` or `string` or `Array<number | string>`
- options: `table`
## removeModel
@@ -111,12 +112,12 @@ Removes all options from the models list with the option names.
exports.ox_target:removeModel(models, optionNames)
```
- models: `number` or `number[]`
- models: `number` or `string` or `Array<number | string>`
- optionNames: `string` or `string[]`
## addEntity
Creates new targetable options for a specific network id (see [NetworkGetNetworkIdFromEntity](https://docs.fivem.net/natives/?_0x9E35DAB6)).
Creates new targetable options for a specific network id or list of network ids (see [NetworkGetNetworkIdFromEntity](https://docs.fivem.net/natives/?_0x9E35DAB6)).
```lua
exports.ox_target:addEntity(netIds, options)
@@ -138,7 +139,7 @@ exports.ox_target:removeEntity(netIds, optionNames)
## addLocalEntity
Creates new targetable options for a specific entity or list of entities.
Creates new targetable options for a specific entity handle or list of entity handles.
```lua
exports.ox_target:addLocalEntity(entities, options)
@@ -168,12 +169,13 @@ exports.ox_target:addSphereZone(parameters)
- parameters: `table`
- coords: `vector`
- radius: `number`
- radius?: `number`
- debug?: `boolean`
- drawSprite?: `boolean`
- options: `table`
**Returns:** `number`
Return:
- id: `number`
## addBoxZone
@@ -185,13 +187,33 @@ exports.ox_target:addBoxZone(parameters)
- parameters: `table`
- coords: `vector`
- size: `vector3`
- rotation: `number`
- size?: `vector3`
- rotation?: `number`
- debug?: `boolean`
- drawSprite?: `boolean`
- options: `table`
**Returns:** `number`
Return:
- id: `number`
## addPolyZone
Creates a new targetable [poly zone](../../ox_lib/Modules/Zones/Shared#libzonespoly).
```lua
exports.ox_target:addPolyZone(parameters)
```
- parameters: `table`
- points: `vector3[]`
- All z values must match
- thickness?: `number`
- debug?: `boolean`
- drawSprite?: `boolean`
- options: `table`
Return:
- id: `number`
## removeZone
@@ -200,3 +222,8 @@ Removes a targetable zone with the given id (returned by addBoxZone/addSphereZon
```lua
exports.ox_target:removeZone(id)
```
- id: `number` or `string`
- The `number` id that is returned by [addSphereZone](#addspherezone), [addBoxZone](#addboxzone), or [addPolyZone](#addpolyzone)
**OR**
- The `string` name that can be specified by the user