mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-01 14:38:50 +00:00
chore: oxmysql and ox_lib clean-up (#134)
* oxmysql and some lib interface fixes - Various fixes throughout oxmysql - started ox_lib audit * chore: More clean up - Reword some confusing descriptions - Add some descriptions - Type fixes - Spelling and grammar fixes - Swapping in `-` where `*` used to be for bullet point consistency ox_lib - Interface, ACL through GetClosestVehicle audited * chore: Finishing up ox_lib
This commit is contained in:
39 files changed
+533
-247
No files matched your search
@@ -5,7 +5,7 @@ import { Tabs, Tab } from 'nextra-theme-docs';
|
||||
|
||||
### lib.addAce
|
||||
|
||||
Assigns the ace permission to a principal. Third parameter defaults to 'allow', while false sets the permission to 'deny'.
|
||||
Assigns the ace permission to a principal. Third parameter defaults to 'allow', while passing `false` sets the permission to 'deny'.
|
||||
|
||||
<Tabs items={["Lua", "JS"]}>
|
||||
<Tab>
|
||||
@@ -36,7 +36,7 @@ lib.addAce('group.admin', 'command.say')
|
||||
|
||||
### lib.removeAce
|
||||
|
||||
Removes the ace permission from a principal. Third parameter defaults to 'allow', while false sets the permission to 'deny'.
|
||||
Removes the ace permission from a principal. Third parameter defaults to 'allow', while passing `false` sets the permission to 'deny'.
|
||||
|
||||
<Tabs items={["Lua", "JS"]}>
|
||||
<Tab>
|
||||
|
||||
@@ -1,17 +1,48 @@
|
||||
Registers keybinds and simplifies interactions of the keybinds.
|
||||
|
||||
### CKeybind
|
||||
|
||||
A table representing a keybind with the following properties.
|
||||
|
||||
- name: `string`
|
||||
- description: `string`
|
||||
- currentKey: `string`
|
||||
- Key that the current user has this keybind set to
|
||||
- disabled: `boolean`
|
||||
- Whether or not the keybind is currently disabled
|
||||
- hash: `number`
|
||||
- Internal hash of the keybind that is used to reference it within the game itself
|
||||
- defaultKey?: `string`
|
||||
- Default key to set the keybind to for new players
|
||||
- NOTE: Changing this will not change the key for existing players
|
||||
- defaultMapper?: `string`
|
||||
- See [Input Mapper Ids](https://docs.fivem.net/docs/game-references/input-mapper-parameter-ids/) for more information
|
||||
- disable: `function(self: CKeybind, disable: boolean)`
|
||||
- Built-in function to enable / disable a keybind
|
||||
- onPressed?: `function(self: CKeybind)`
|
||||
- User-defined function triggered on keybind press
|
||||
- onReleased?: `function(self: CKeybind)`
|
||||
- User-defined function triggered on keybind release
|
||||
|
||||
### lib.addKeybind
|
||||
|
||||
```lua
|
||||
lib.addKeybind(data)
|
||||
```
|
||||
|
||||
* data: `table`
|
||||
* name: `string`
|
||||
* description: `string`
|
||||
* defaultKey?: `string`
|
||||
* Default: None
|
||||
* currentKey: `string`
|
||||
* disabled?: `boolean`
|
||||
* disable?: `function`(self: `table`, toggle: `boolean`)
|
||||
* onPressed?: `function`(self: `table`)
|
||||
* onReleased?: `function`(self: `table`)
|
||||
- data: `table`
|
||||
- name: `string`
|
||||
- description: `string`
|
||||
- defaultKey?: `string`
|
||||
- Default: `None`
|
||||
- defaultMapper?: `string`
|
||||
- Default: `keyboard`
|
||||
- disabled?: `boolean`
|
||||
- Whether or not the keybind should be disabled by default
|
||||
- onPressed?: `function(self: CKeybind)`
|
||||
- Function triggered on keybind press
|
||||
- onReleased?: `function(self: CKeybind)`
|
||||
- Function triggered on keybind release
|
||||
|
||||
```lua
|
||||
local keybind = lib.addKeybind({
|
||||
@@ -23,13 +54,15 @@ local keybind = lib.addKeybind({
|
||||
end,
|
||||
onReleased = function(self)
|
||||
print(('released %s (%s)'):format(self.currentKey, self.name))
|
||||
end,
|
||||
end
|
||||
})
|
||||
```
|
||||
|
||||
Keybinds can be enabled/disabled by using the disable method.
|
||||
### Enable / Disable Keybinds
|
||||
|
||||
Keybinds can be enabled / disabled by using the disable method.
|
||||
|
||||
```lua
|
||||
keybind:disable(true) -- disable
|
||||
keybind:disable(false) -- enable
|
||||
keybind:disable(true) -- disables the keybind
|
||||
keybind:disable(false) -- enables the keybind
|
||||
```
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Tabs, Tab } from 'nextra-theme-docs';
|
||||
|
||||
Caches data related to the player and handling some events or statebags.
|
||||
Caches data related to the player.
|
||||
An interval runs every 100ms to update data that cannot be checked via handlers.
|
||||
|
||||
## States
|
||||
@@ -11,18 +11,18 @@ An interval runs every 100ms to update data that cannot be checked via handlers.
|
||||
- player id
|
||||
- serverId: `number`
|
||||
- player server id
|
||||
- weapon: `number` or `false`
|
||||
- current weapon hash
|
||||
- vehicle: `number` or `false`
|
||||
- vehicle entity id
|
||||
- seat: `number` or `false`
|
||||
- vehicle seat index
|
||||
- resource: `string`
|
||||
- invoking resource name
|
||||
- weapon: `number` or `false`
|
||||
- current ped weapon
|
||||
- coords: `vec3`
|
||||
- coords: `vector3`
|
||||
- current player coords
|
||||
- only populated if using `zones` or `points`
|
||||
- cannot be listened for with `onCache`
|
||||
- cannot be listened for with `lib.onCache`
|
||||
- resource: `string`
|
||||
- invoking resource name
|
||||
- mount: `number` or `false` (RedM only)
|
||||
- mount entity id
|
||||
|
||||
@@ -38,6 +38,11 @@ lib.onCache(key, function(value) end)
|
||||
```
|
||||
|
||||
- key: `string`
|
||||
- `ped`
|
||||
- `vehicle`
|
||||
- `seat`
|
||||
- `weapon`
|
||||
- `mount` (RedM only)
|
||||
- value: `any`
|
||||
|
||||
```lua
|
||||
|
||||
@@ -6,9 +6,10 @@
|
||||
triggerServerCallback(eventName, delay, ...args)
|
||||
```
|
||||
|
||||
* eventName: `string`
|
||||
* delay: `number` or `null`
|
||||
* ..args: `any`
|
||||
- eventName: `string`
|
||||
- delay: `number` or `null`
|
||||
- Amount of time until this callback can be triggered again
|
||||
- ..args: `any`
|
||||
|
||||
## Register Client Callback
|
||||
|
||||
@@ -18,8 +19,8 @@ triggerServerCallback(eventName, delay, ...args)
|
||||
onServerCallback(eventName, cb)
|
||||
```
|
||||
|
||||
* eventName: `string`
|
||||
* cb: `function`(...args: `any`)
|
||||
- eventName: `string`
|
||||
- cb: `function`(...args: `any`)
|
||||
|
||||
## Usage Example
|
||||
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
triggerClientCallback(eventName, playerId, ...args)
|
||||
```
|
||||
|
||||
* eventName: `string`
|
||||
* playerId: `number`
|
||||
* ...args: `any`
|
||||
- eventName: `string`
|
||||
- playerId: `number`
|
||||
- ...args: `any`
|
||||
|
||||
## Register Client Callback
|
||||
## Register Server Callback
|
||||
|
||||
### onClientCallback
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ lib.callback(name, delay, cb, ...)
|
||||
|
||||
- name: `string`
|
||||
- delay: `number` or `false`
|
||||
- Amount of time until this callback can be triggered again
|
||||
- cb: `function`
|
||||
- ...: `any`
|
||||
|
||||
@@ -29,6 +30,7 @@ lib.callback.await(name, delay, ...)
|
||||
|
||||
- name: `string`
|
||||
- delay: `number` or `false`
|
||||
- Amount of time until this callback can be triggered again
|
||||
- ...: `any`
|
||||
|
||||
```lua
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
The response is handled in a separate coroutine.
|
||||
|
||||
```lua
|
||||
lib.callback(name, source, cb, ...)
|
||||
lib.callback(name, playerId, cb, ...)
|
||||
```
|
||||
|
||||
- name: `string`
|
||||
- source: `number`
|
||||
- playerId: `number`
|
||||
- cb: `function`
|
||||
- ...: `any`
|
||||
|
||||
@@ -26,11 +26,11 @@ end, args.radius)
|
||||
The current coroutine is yielded until a response is received.
|
||||
|
||||
```lua
|
||||
lib.callback.await(name, source, ...)
|
||||
lib.callback.await(name, playerId, ...)
|
||||
```
|
||||
|
||||
- name: `string`
|
||||
- source: `number`
|
||||
- playerId: `number`
|
||||
- ...: `any`
|
||||
|
||||
```lua
|
||||
|
||||
@@ -38,11 +38,10 @@ Creates a new [cronjob](https://en.wikipedia.org/wiki/Cron), scheduling a task t
|
||||
lib.cron.new(expression, job, options)
|
||||
```
|
||||
|
||||
* expression:
|
||||
* string A cron expression such as `* * * * *` representing minute, hour, day, month, and day of the week
|
||||
* job:
|
||||
* fun(task: `OxTask`, date: `osdate`)
|
||||
* options?:
|
||||
* debug?: `boolean`
|
||||
- expression: `string`
|
||||
- A cron expression such as `* * * * *` representing minute, hour, day, month, and day of the week
|
||||
- job: `fun(task: OxTask, date: osdate)`
|
||||
- options?: `table`
|
||||
- debug?: `boolean`
|
||||
|
||||
**returns**: OxTask
|
||||
@@ -1,6 +1,8 @@
|
||||
A centralized way to track and disable controls.
|
||||
|
||||
### lib.disableControls
|
||||
|
||||
Call on frame to disable all stored keys.
|
||||
Call on frame to disable all stored controls.
|
||||
|
||||
```lua
|
||||
lib.disableControls()
|
||||
@@ -8,24 +10,35 @@ lib.disableControls()
|
||||
|
||||
### lib.disableControls:Add
|
||||
|
||||
Adds the specified control(s) to the stored list.
|
||||
If the control is already being tracked, the stored counter will be incremented.
|
||||
|
||||
```lua
|
||||
lib.disableControls:Add(...)
|
||||
```
|
||||
|
||||
* vararg: `number`
|
||||
- vararg: `number` or `table`
|
||||
- Control(s) to add a stored count of
|
||||
|
||||
### lib.disableControls:Remove
|
||||
|
||||
Removes the specified control(s) from the stored list.
|
||||
If the stored counter for a given control is greater than one, the stored counter will be decremented.
|
||||
|
||||
```lua
|
||||
lib.disableControls:Remove(...)
|
||||
```
|
||||
|
||||
* vararg: `number`
|
||||
- vararg: `number` or `table`
|
||||
- Control(s) to remove a stored count of
|
||||
|
||||
### lib.disableControls:Clear
|
||||
|
||||
Clears the stored counter(s) for the specified control(s).
|
||||
|
||||
```lua
|
||||
lib.disableControls:Clear(...)
|
||||
```
|
||||
|
||||
* vararg: `number`
|
||||
- vararg: `number` or `table`
|
||||
- Control(s) to clear out from being tracked
|
||||
@@ -6,12 +6,13 @@ Get the object handle and coords of the closest object to a set of coordinates.
|
||||
lib.getClosestObject(coords, maxDistance)
|
||||
```
|
||||
|
||||
* coords: `vector3`
|
||||
* The coords to check from.
|
||||
* maxDistance: `number`
|
||||
* The max distance to check.
|
||||
- coords: `vector3`
|
||||
- The coords to check from.
|
||||
- maxDistance?: `number`
|
||||
- The max distance to check.
|
||||
- Default: `2.0`
|
||||
|
||||
Return:
|
||||
|
||||
* ped?: `number`
|
||||
* coords?: `number`
|
||||
- object?: `number`
|
||||
- coords?: `vector3`
|
||||
@@ -6,12 +6,13 @@ Get the ped handle and coords of the closest ped to a set of coordinates.
|
||||
lib.getClosestPed(coords, maxDistance)
|
||||
```
|
||||
|
||||
* coords: `vector3`
|
||||
* The coords to check from.
|
||||
* maxDistance: `number`
|
||||
* The max distance to check.
|
||||
- coords: `vector3`
|
||||
- The coords to check from.
|
||||
- maxDistance?: `number`
|
||||
- The max distance to check.
|
||||
- Default: `2.0`
|
||||
|
||||
Return:
|
||||
|
||||
* ped?: `number`
|
||||
* coords?: `number`
|
||||
- ped?: `number`
|
||||
- coords?: `vector3`
|
||||
@@ -1,20 +1,22 @@
|
||||
### lib.getClosestPlayer
|
||||
|
||||
Get the id, ped, and coords of the closest player to a set of coordinates.
|
||||
Get the player id, ped handle, and coords of the closest player to a set of coordinates.
|
||||
|
||||
```lua
|
||||
lib.getClosestPlayer(coords, maxDistance, includePlayer)
|
||||
```
|
||||
|
||||
* coords: `vector3`
|
||||
* The coords to check from.
|
||||
* maxDistance: `number`
|
||||
* The max distance to check.
|
||||
* includePlayer: `boolean`
|
||||
* Whether or not to include the current player.
|
||||
- coords: `vector3`
|
||||
- The coords to check from.
|
||||
- maxDistance?: `number`
|
||||
- The max distance to check.
|
||||
- Default: `2.0`
|
||||
- includePlayer?: `boolean`
|
||||
- Whether or not to include the current player.
|
||||
- Default: `false`
|
||||
|
||||
Return:
|
||||
|
||||
* playerId?: `number`
|
||||
* playerPed?: `number`
|
||||
* playerCoords?: `vector3`
|
||||
- playerId?: `number`
|
||||
- playerPed?: `number`
|
||||
- playerCoords?: `vector3`
|
||||
@@ -1,19 +1,21 @@
|
||||
### lib.getClosestVehicle
|
||||
|
||||
Get the id and coords of the closest vehicle to a set of coordinates.
|
||||
Get the vehicle handle and coords of the closest vehicle to a set of coordinates.
|
||||
|
||||
```lua
|
||||
lib.getClosestVehicle(coords, maxDistance, includePlayerVehicle)
|
||||
```
|
||||
|
||||
* coords: `vector3`
|
||||
* The coords to check from.
|
||||
* maxDistance: `number`
|
||||
* The max distance to check.
|
||||
* includePlayerVehicle: `boolean`
|
||||
* Whether or not to include the player's current vehicle.
|
||||
- coords: `vector3`
|
||||
- The coords to check from.
|
||||
- maxDistance?: `number`
|
||||
- The max distance to check.
|
||||
- Default: `2.0`
|
||||
- includePlayerVehicle?: `boolean`
|
||||
- Whether or not to include the player's current vehicle.
|
||||
- Default: `false`
|
||||
|
||||
Return:
|
||||
|
||||
* vehicle?: `number`
|
||||
* vehicleCoords?: `vector3`
|
||||
- vehicle?: `number`
|
||||
- vehicleCoords?: `vector3`
|
||||
@@ -6,11 +6,12 @@ Get the object handle and coords of all objects within range of a set of coordin
|
||||
lib.getNearbyObjects(coords, maxDistance)
|
||||
```
|
||||
|
||||
* coords: `vector3`
|
||||
* The coords to check from.
|
||||
* maxDistance: `number`
|
||||
* The max distance to check.
|
||||
- coords: `vector3`
|
||||
- The coords to check from.
|
||||
- maxDistance?: `number`
|
||||
- The max distance to check.
|
||||
- Default: `2.0`
|
||||
|
||||
Return:
|
||||
|
||||
* `{ object: number, coords: vector3 }[]`
|
||||
- objects: `{ object: number, coords: vector3 }[]`
|
||||
@@ -6,11 +6,12 @@ Get the ped handle and coords of all peds within range of a set of coordinates.
|
||||
lib.getNearbyPeds(coords, maxDistance)
|
||||
```
|
||||
|
||||
* coords: `vector3`
|
||||
* The coords to check from.
|
||||
* maxDistance: `number`
|
||||
* The max distance to check.
|
||||
- coords: `vector3`
|
||||
- The coords to check from.
|
||||
- maxDistance?: `number`
|
||||
- The max distance to check.
|
||||
- Default: `2.0`
|
||||
|
||||
Return:
|
||||
|
||||
* `{ ped: number, coords: vector3 }[]`
|
||||
- peds: `{ ped: number, coords: vector3 }[]`
|
||||
@@ -1,18 +1,20 @@
|
||||
### lib.getNearbyPlayers
|
||||
|
||||
Get the id, ped, and coords of all players within range of a set of coordinates.
|
||||
Get the player id, ped handle, and coords of all players within range of a set of coordinates.
|
||||
|
||||
```lua
|
||||
lib.getNearbyPlayers(coords, maxDistance, includePlayer)
|
||||
```
|
||||
|
||||
* coords: `vector3`
|
||||
* The coords to check from.
|
||||
* maxDistance: `number`
|
||||
* The max distance to check.
|
||||
* includePlayer: `boolean`
|
||||
* Whether or not to include the current player.
|
||||
- coords: `vector3`
|
||||
- The coords to check from.
|
||||
- maxDistance?: `number`
|
||||
- The max distance to check.
|
||||
- Default: `2.0`
|
||||
- includePlayer?: `boolean`
|
||||
- Whether or not to include the current player.
|
||||
- Default: `false`
|
||||
|
||||
Return:
|
||||
|
||||
* `{ id: number, ped: number, coords: vector3 }[]`
|
||||
- players: `{ id: number, ped: number, coords: vector3 }[]`
|
||||
@@ -1,18 +1,20 @@
|
||||
### lib.getNearbyVehicles
|
||||
|
||||
Get the id and coords of all vehicles within range of a set of coordinates.
|
||||
Get the vehicle handle and coords of all vehicles within range of a set of coordinates.
|
||||
|
||||
```lua
|
||||
lib.getNearbyVehicles(coords, maxDistance, includePlayerVehicle)
|
||||
```
|
||||
|
||||
* coords: `vector3`
|
||||
* The coords to check from.
|
||||
* maxDistance: `number`
|
||||
* The max distance to check.
|
||||
* includePlayerVehicle: `boolean`
|
||||
* Whether or not to include the player's current vehicle.
|
||||
- coords: `vector3`
|
||||
- The coords to check from.
|
||||
- maxDistance?: `number`
|
||||
- The max distance to check.
|
||||
- Default: `2.0`
|
||||
- includePlayerVehicle?: `boolean`
|
||||
- Whether or not to include the player's current vehicle.
|
||||
- Default: `false`
|
||||
|
||||
Return:
|
||||
|
||||
* `{ vehicle: number, coords: vector3 }[]`
|
||||
- vehicles: `{ vehicle: number, coords: vector3 }[]`
|
||||
@@ -62,8 +62,8 @@ lib.alertDialog(data);
|
||||
- cancel?: `string`
|
||||
- confirm?: `string`
|
||||
|
||||
Returns `confirm` if the player pressed the confirm button, otherwise if the player pressed the cancel button
|
||||
or has exited the dialog with ESC the return will be `cancel`.
|
||||
Returns `'confirm'` if the player pressed the confirm button, otherwise if the player pressed the cancel button
|
||||
or has exited the dialog with ESC the return will be `'cancel'`.
|
||||
|
||||
### lib.closeAlertDialog
|
||||
|
||||
|
||||
@@ -207,7 +207,7 @@ lib.closeInputDialog();
|
||||
local input = lib.inputDialog('Basic dialog', {'First row', 'Second row'})
|
||||
|
||||
if not input then return end
|
||||
print(input, input[1], input[2])
|
||||
print(json.encode(input), input[1], input[2])
|
||||
```
|
||||
|
||||
</Tab>
|
||||
@@ -247,7 +247,7 @@ local input = lib.inputDialog('Dialog title', {
|
||||
|
||||
print(json.encode(input))
|
||||
|
||||
-- Getting rgbb values from colour picker
|
||||
-- Getting rgb values from colour picker
|
||||
local rgb = lib.math.torgba(input[4])
|
||||
|
||||
-- Transforming date timestamp to a readable format with Lua's os library (server-only)
|
||||
|
||||
@@ -70,6 +70,7 @@ lib.registerMenu(data, cb);
|
||||
- onSideScroll: `function`(selected: `number`, scrollIndex: `number`, args: `{[string]: any}`)
|
||||
- Function ran whenever a scroll list item is changed.
|
||||
- onCheck: `function`(selected: `number`, checked: `boolean`, args: `{[string]: any}`)
|
||||
- Function ran whenever a checkbox is toggled.
|
||||
- cb: `function`(selected: `number`, scrollIndex: `number`, args: `{[string]: any}`)
|
||||
- Callback function when the menu item is pressed.
|
||||
|
||||
|
||||
@@ -32,16 +32,17 @@ lib.addRadialItem(items);
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
- id: `string`
|
||||
- Id that is used for removing options.
|
||||
- icon: `string`
|
||||
- label: `string`
|
||||
- Label uses ` \n` to insert a newline
|
||||
- menu?: `string`
|
||||
- Id of a menu to open.
|
||||
- onSelect: `function(currentMenu: string | nil, itemIndex: number)` | `string`
|
||||
- Function that's ran when a user clicks the item.
|
||||
- keepOpen?: `boolean`
|
||||
- items: `table` (`object` or `array`)
|
||||
- id: `string`
|
||||
- Id that is used for removing options.
|
||||
- icon: `string`
|
||||
- label: `string`
|
||||
- Label uses ` \n` to insert a newline
|
||||
- menu?: `string`
|
||||
- Id of a menu to open.
|
||||
- onSelect: `function(currentMenu: string | nil, itemIndex: number)` | `string`
|
||||
- Function that's ran when a user clicks the item.
|
||||
- keepOpen?: `boolean`
|
||||
|
||||
### lib.removeRadialItem
|
||||
|
||||
@@ -114,16 +115,17 @@ lib.registerRadial(radial);
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
- id: `string`
|
||||
- Unique menu id used to open with `menu` prop on an item.
|
||||
- items: `array`
|
||||
- icon: `string`
|
||||
- label: `string`
|
||||
- Label uses ` \n` to insert a newline
|
||||
- menu?: `string`
|
||||
- Id of a menu to open.
|
||||
- onSelect?: `function(currentMenu: string | nil, itemIndex: number)` | `string`
|
||||
- Function that's ran when a user clicks the item.
|
||||
- radial: `table` (`object`)
|
||||
- id: `string`
|
||||
- Unique menu id used to open with `menu` prop on an item.
|
||||
- items: `array`
|
||||
- icon: `string`
|
||||
- label: `string`
|
||||
- Label uses ` \n` to insert a newline
|
||||
- menu?: `string`
|
||||
- Id of a menu to open.
|
||||
- onSelect?: `function(currentMenu: string | nil, itemIndex: number)` | `string`
|
||||
- Function that's ran when a user clicks the item.
|
||||
|
||||
### lib.hideRadial
|
||||
|
||||
@@ -174,12 +176,35 @@ lib.disableRadial(state);
|
||||
- state: `boolean`
|
||||
- Whether or not radial menu should be disabled
|
||||
|
||||
### lib.getCurrentRadialId
|
||||
|
||||
Returns the id of the currently open radial menu.
|
||||
|
||||
<Tabs items={["Lua", "JS"]}>
|
||||
<Tab>
|
||||
|
||||
```lua
|
||||
local id = lib.getCurrentRadialId()
|
||||
```
|
||||
|
||||
</Tab>
|
||||
<Tab>
|
||||
|
||||
```ts
|
||||
import lib from '@overextended/ox_lib/client';
|
||||
|
||||
let id = lib.getCurrentRadialId();
|
||||
```
|
||||
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
### Usage Example
|
||||
|
||||
<Callout>
|
||||
|
||||
When adding radial menu items whether they are global or for a sub menu, make sure to stick to short as possible labels
|
||||
as long labels will look out of place and should not be used with the radial menu because of it's density.
|
||||
as long labels will look out of place and should not be used with the radial menu because of its density.
|
||||
|
||||
</Callout>
|
||||
|
||||
|
||||
@@ -27,16 +27,19 @@ lib.skillCheck(difficulty, inputs);
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
- difficulty: `easy` or `medium` or `hard` or `object`
|
||||
- Can set custom difficulty by sending a object instead of string
|
||||
- `{ areaSize: number, speedMultiplier: number }`
|
||||
- easy: `{ areaSize: 50, speedMultiplier: 1 }`
|
||||
- medium: `{ areaSize: 40, speedMultiplier: 1.5 }`
|
||||
- hard: `{ areaSize: 25, speedMultiplier: 1.75 }`
|
||||
- `areaSize` size of the area in degrees.
|
||||
- Sending an array will chain the checks together and return false if one fails and true if all succeed
|
||||
- inputs: `string[]`
|
||||
- Picks a random key from the inputs table to use on each skill check pass.
|
||||
- difficulty: `'easy'` or `'medium'` or `'hard'` or `table`
|
||||
- Preset difficulties:
|
||||
- 'easy' - `{ areaSize: 50, speedMultiplier: 1 }`
|
||||
- 'medium' - `{ areaSize: 40, speedMultiplier: 1.5 }`
|
||||
- 'hard' - `{ areaSize: 25, speedMultiplier: 1.75 }`
|
||||
- Custom difficulties can be set by sending an object instead of one of the preset strings above
|
||||
- areaSize: `number`
|
||||
- Size of the success area in degrees
|
||||
- speedMultiplier: `number`
|
||||
- Multiplier for the speed of the indicator
|
||||
- inputs?: `string[]`
|
||||
- A random key will be picked from the inputs table for each skill check
|
||||
- If no inputs are defined the key is defaulted to `e`
|
||||
|
||||
### Usage Example
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ Show the TextUI window.
|
||||
|
||||
<Callout type="warning">
|
||||
|
||||
**DO NOT** run this function every tick, it's intented to be used as a toggle.
|
||||
**DO NOT** run this function every tick, it's intended to be used as a toggle.
|
||||
|
||||
</Callout>
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ Allows servers to set a preferred language and attempt to load locale files in a
|
||||
Locale files should use the [ISO Language Code](http://www.lingoes.net/en/translator/langcode.htm) and be saved as `./locales/langcode.json`
|
||||
|
||||
## Setup
|
||||
To change the preferred language from English, add the convar to your server.cfg
|
||||
To change the preferred language from English, add the convar to your server.cfg and change `en` to the desired language code.
|
||||
|
||||
```yaml
|
||||
setr ox:locale en
|
||||
@@ -10,25 +10,25 @@ setr ox:locale en
|
||||
|
||||
Create a locales directory and a file for your language.
|
||||
|
||||
```json title="locales/en.json"
|
||||
```json filename="locales/en.json"
|
||||
{
|
||||
"grand_theft_auto": "grand theft auto",
|
||||
"male": "male",
|
||||
"female": "female",
|
||||
"suspect_sex": "suspect is %s",
|
||||
"suspect_sex": "suspect is %s"
|
||||
}
|
||||
```
|
||||
|
||||
```json title="locales/fr.json"
|
||||
```json filename="locales/fr.json"
|
||||
{
|
||||
"grand_theft_auto": "vol de voiture",
|
||||
"male": "homme",
|
||||
"female": "femme",
|
||||
"suspect_sex": "le suspect est %s",
|
||||
"suspect_sex": "le suspect est %s"
|
||||
}
|
||||
```
|
||||
|
||||
```lua title="fxmanifest.lua"
|
||||
```lua filename="fxmanifest.lua"
|
||||
files {
|
||||
'locales/*.json'
|
||||
}
|
||||
@@ -49,8 +49,8 @@ Additional arguments can be sent to format the locale output.
|
||||
locale(str, ...)
|
||||
```
|
||||
|
||||
* str: `string`
|
||||
* ...: `string` or `number`
|
||||
- str: `string`
|
||||
- vararg?: `string` or `number`
|
||||
|
||||
```lua
|
||||
-- Load the locale module
|
||||
@@ -72,6 +72,7 @@ You can create a locale string that references other locales to construct a phra
|
||||
"hello_my_name_is": "${hello}! ${my_name_is}."
|
||||
}
|
||||
```
|
||||
|
||||
```lua
|
||||
print(locale('hello_my_name_is', 'doka', 'linden'))
|
||||
```
|
||||
@@ -12,7 +12,7 @@ lib.logger(source, event, message, ...)
|
||||
- A name for the log event (i.e. the trigerring event or a description)
|
||||
- message: `string`
|
||||
- The content for the log.
|
||||
- ...: `string`
|
||||
- vararg: `string`
|
||||
- Additional arguments are converted to tags for additional filtering and searching.
|
||||
|
||||
### Example
|
||||
@@ -68,7 +68,7 @@ It is designed to be very cost effective and easy to operate.
|
||||
|
||||
</Tab>
|
||||
<Tab>
|
||||
To setup a grafana instance you'll require docker, and knowledge on containers or kubernetes.
|
||||
To setup a grafana instance you'll need docker, and knowledge on containers or kubernetes.
|
||||
Please find a guide to setup a grafana stack (min requirement grafana and grafana loki) and follow that.
|
||||
|
||||
Once done, setup authentication and use the username and password securing your endpoint.
|
||||
|
||||
@@ -69,3 +69,19 @@ math.tohex(n, upper)
|
||||
Return:
|
||||
|
||||
- hex: `string`
|
||||
|
||||
### math.groupdigits
|
||||
|
||||
Takes a number and formats it into grouped digits.
|
||||
|
||||
```lua
|
||||
math.groupdigits(number, seperator)
|
||||
```
|
||||
|
||||
- number: `number`
|
||||
- seperator?: `string`
|
||||
- Default: `,`
|
||||
|
||||
Return:
|
||||
|
||||
- groupedDigits: `string`
|
||||
@@ -6,12 +6,12 @@ Simple and centralised distance checking, supporting callbacks when entering, le
|
||||
Point<T>({coords, distance, onEnter, onExit, nearby, args})
|
||||
```
|
||||
|
||||
* coords: `number[]`
|
||||
* distance: `number`
|
||||
* onEnter?: `function`
|
||||
* onExit?: `function`
|
||||
* nearby?: `function`
|
||||
* args?: `T`
|
||||
- coords: `number[]`
|
||||
- distance: `number`
|
||||
- onEnter?: `function`
|
||||
- onExit?: `function`
|
||||
- nearby?: `function`
|
||||
- args?: `T`
|
||||
|
||||
```ts
|
||||
import { Point, cache } from '@overextended/ox_lib/client'
|
||||
@@ -43,4 +43,3 @@ point.onExit = () => {
|
||||
console.log('Left range of point', point.id)
|
||||
}
|
||||
```
|
||||
|
||||
@@ -4,17 +4,23 @@ Simple and centralised distance checking, supporting callbacks when entering, le
|
||||
|
||||
### CPoint
|
||||
|
||||
A table representing a point, with the following properties.
|
||||
A table representing a point with the following properties.
|
||||
|
||||
* id: `number`
|
||||
* coords: `vector3`
|
||||
* distance: `number`
|
||||
* The distance for the player to be "inside" a point (i.e. the point's radius).
|
||||
* currentDistance: `number`
|
||||
* The players current distance from the centre of the point.
|
||||
* isClosest?: `boolean`
|
||||
* remove: `function()`
|
||||
* Removes the point from the points registry.
|
||||
- id: `number`
|
||||
- coords: `vector3`
|
||||
- distance: `number`
|
||||
- The distance for the player to be "inside" a point (i.e. the point's radius).
|
||||
- currentDistance: `number`
|
||||
- The players current distance from the centre of the point.
|
||||
- isClosest?: `boolean`
|
||||
- remove: `function()`
|
||||
- Removes the point from the points registry.
|
||||
- onEnter?: `function(self: CPoint)`
|
||||
- Function triggered when player gets within `distance` of the point
|
||||
- onExit?: `function(self: CPoint)`
|
||||
- Function triggered when player goes beyond `distance` of the point
|
||||
- nearby?: `function(self: CPoint)`
|
||||
- Function triggered on frame when within `distance` of the point
|
||||
|
||||
### lib.points.new
|
||||
|
||||
@@ -22,12 +28,15 @@ A table representing a point, with the following properties.
|
||||
lib.points.new(data)
|
||||
```
|
||||
|
||||
* data: `table`
|
||||
* coords: `vector3`
|
||||
* distance: `number`
|
||||
- data: `table`
|
||||
- coords: `vector3`
|
||||
- distance: `number`
|
||||
|
||||
**Returns:** CPoint
|
||||
Returns:
|
||||
|
||||
- point: `CPoint`
|
||||
|
||||
#### Example
|
||||
```lua
|
||||
local point = lib.points.new({
|
||||
coords = GetEntityCoords(cache.ped),
|
||||
@@ -60,7 +69,9 @@ Get a table of all points created in the resource.
|
||||
lib.points.getAllPoints()
|
||||
```
|
||||
|
||||
**Return:** `table<number, CPoint>`
|
||||
Return:
|
||||
|
||||
- points: `CPoint[]`
|
||||
|
||||
### lib.points.getNearbyPoints
|
||||
|
||||
@@ -70,7 +81,9 @@ Get an array of all points in range of the player.
|
||||
lib.points.getNearbyPoints()
|
||||
```
|
||||
|
||||
**Return:** `CPoint[]`
|
||||
Return:
|
||||
|
||||
- nearbyPoints: `CPoint[]`
|
||||
|
||||
### lib.points.getClosestPoint
|
||||
|
||||
@@ -80,4 +93,6 @@ Get the data for the closest point to the player.
|
||||
lib.points.getClosestPoint()
|
||||
```
|
||||
|
||||
**Returns:** `CPoint`
|
||||
Return:
|
||||
|
||||
- closestPoint?: `CPoint`
|
||||
@@ -1,21 +1,28 @@
|
||||
### lib.raycast.cam
|
||||
|
||||
Starts a shapetest originating from the camera, extending to ~10m.
|
||||
Starts a shapetest originating from the camera, extending to ~10m by default.
|
||||
|
||||
```lua
|
||||
lib.raycast.cam(flags, ignore, distance)
|
||||
```
|
||||
|
||||
* flags?: `number`
|
||||
* Defaults to 1|2|8|16 (see: https://docs.fivem.net/natives/?_0x377906D8A31E5586)
|
||||
* ignore?: `number`
|
||||
* A bit mask with bits 1, 2, 4, or 7 relating to collider types. 4 and 7 are usually used.
|
||||
* distance?: `number`
|
||||
- flags?: `number`
|
||||
- See: https://docs.fivem.net/natives/?_0x377906D8A31E5586
|
||||
- Default: `511`
|
||||
- ignore?: `number`
|
||||
- A bit mask with bits 1, 2, 4, or 7 relating to collider types. 4 and 7 are usually used.
|
||||
- Default: `4`
|
||||
- distance?: `number`
|
||||
- Default: `10`
|
||||
|
||||
Return:
|
||||
|
||||
* hit: `boolean`
|
||||
* entityHit: `number`
|
||||
* endCoords: `vector3`
|
||||
* surfaceNormal: `vector3`
|
||||
* materialHash: `number`
|
||||
- hit: `boolean`
|
||||
- Whether or not an entity was hit
|
||||
- entityHit: `number`
|
||||
- Entity handle of hit entity
|
||||
- endCoords: `vector3`
|
||||
- Closest coords to where the raycast hit
|
||||
- surfaceNormal: `vector3`
|
||||
- Normal to the surface that was hit
|
||||
- materialHash: `number`
|
||||
@@ -24,9 +24,10 @@ lib.requestAnimDict(dict, timeout)
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
* dict: `string`
|
||||
* timeout: `number`
|
||||
* Default: `100`
|
||||
- dict: `string`
|
||||
- timeout?: `number`
|
||||
- Number of ticks to wait for the asset to load.
|
||||
- Default: `500`
|
||||
|
||||
### lib.requestAnimSet
|
||||
|
||||
@@ -49,9 +50,10 @@ lib.requestAnimSet(set, timeout)
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
* set: `string`
|
||||
* timeout: `number`
|
||||
* Default: `100`
|
||||
- set: `string`
|
||||
- timeout?: `number`
|
||||
- Number of ticks to wait for the asset to load.
|
||||
- Default: `500`
|
||||
|
||||
### lib.requestModel
|
||||
|
||||
@@ -74,9 +76,10 @@ lib.requestModel(model, timeout)
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
* model: `string`
|
||||
* timeout: `number`
|
||||
* Default: `100`
|
||||
- model: `string`
|
||||
- timeout?: `number`
|
||||
- Number of ticks to wait for the asset to load.
|
||||
- Default: `500`
|
||||
|
||||
### lib.requestStreamedTextureDict
|
||||
|
||||
@@ -99,9 +102,10 @@ lib.requestStreamedTextureDict(dict, timeout)
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
* dict: `string`
|
||||
* timeout: `number`
|
||||
* Default: `100`
|
||||
- dict: `string`
|
||||
- timeout?: `number`
|
||||
- Number of ticks to wait for the asset to load.
|
||||
- Default: `500`
|
||||
|
||||
### lib.requestNamedPtfxAsset
|
||||
|
||||
@@ -109,7 +113,7 @@ lib.requestStreamedTextureDict(dict, timeout)
|
||||
<Tab>
|
||||
|
||||
```lua
|
||||
lib.requestNamedPtfxAsset(fxName, timeout)
|
||||
lib.requestNamedPtfxAsset(ptFxName, timeout)
|
||||
```
|
||||
|
||||
</Tab>
|
||||
@@ -118,15 +122,16 @@ lib.requestNamedPtfxAsset(fxName, timeout)
|
||||
```ts
|
||||
import lib from '@overextended/ox_lib/client'
|
||||
|
||||
lib.requestNamedPtfxAsset(fxName, timeout)
|
||||
lib.requestNamedPtfxAsset(ptFxName, timeout)
|
||||
```
|
||||
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
* fxName: `string`
|
||||
* timeout: `number`
|
||||
* Default: `100`
|
||||
- ptFxName: `string`
|
||||
- timeout?: `number`
|
||||
- Number of ticks to wait for the asset to load.
|
||||
- Default: `500`
|
||||
|
||||
### lib.requestScaleformMovie
|
||||
|
||||
@@ -134,7 +139,7 @@ lib.requestNamedPtfxAsset(fxName, timeout)
|
||||
<Tab>
|
||||
|
||||
```lua
|
||||
lib.requestScaleformMovie(scaleformMovie, timeout)
|
||||
lib.requestScaleformMovie(scaleformName, timeout)
|
||||
```
|
||||
|
||||
</Tab>
|
||||
@@ -143,15 +148,16 @@ lib.requestScaleformMovie(scaleformMovie, timeout)
|
||||
```ts
|
||||
import lib from '@overextended/ox_lib/client'
|
||||
|
||||
lib.requestScaleformMovie(scaleformMovie, timeout)
|
||||
lib.requestScaleformMovie(scaleformName, timeout)
|
||||
```
|
||||
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
* dict: `string`
|
||||
* timeout: `number`
|
||||
* Default: `100`
|
||||
- scaleformName: `string`
|
||||
- timeout?: `number`
|
||||
- Number of ticks to wait for the asset to load.
|
||||
- Default: `500`
|
||||
|
||||
### lib.requestWeaponAsset
|
||||
|
||||
@@ -174,18 +180,16 @@ lib.requestWeaponAsset(weaponType, timeout, weaponResourceFlags, extraWeaponComp
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
* weaponType: `string | number`
|
||||
* timeout: `number?`
|
||||
* Number of ticks to wait for the asset to load. Default is `500`
|
||||
* weaponResourceFlags: `WeaponResourceFlags?`
|
||||
* Default is `31`
|
||||
* extraWeaponComponentFlags: `ExtraWeaponComponentFlags?`
|
||||
* Default is `0`
|
||||
- weaponType: `string | number`
|
||||
- timeout?: `number`
|
||||
- Number of ticks to wait for the asset to load.
|
||||
- Default: `500`
|
||||
- weaponResourceFlags?: `WeaponResourceFlags`
|
||||
- Default: `31`
|
||||
- extraWeaponComponentFlags?: `ExtraWeaponComponentFlags`
|
||||
- Default: `0`
|
||||
|
||||
Return:
|
||||
* `string | number?` weaponType
|
||||
|
||||
### WeaponResourceFlags
|
||||
#### WeaponResourceFlags
|
||||
|
||||
```
|
||||
1 WRF_REQUEST_BASE_ANIMS
|
||||
@@ -197,7 +201,7 @@ Return:
|
||||
31 WRF_REQUEST_ALL_ANIMS
|
||||
```
|
||||
|
||||
### ExtraWeaponComponentFlags
|
||||
#### ExtraWeaponComponentFlags
|
||||
|
||||
```
|
||||
0 WEAPON_COMPONENT_NONE
|
||||
|
||||
@@ -1,11 +1,18 @@
|
||||
Adds additional functions alongside the standard table library
|
||||
|
||||
## lib.table.contains
|
||||
|
||||
```lua
|
||||
lib.table.contains(table, value)
|
||||
lib.table.contains(tbl, value)
|
||||
```
|
||||
|
||||
* table: `table`
|
||||
* value: `any`
|
||||
Checks if `table` contains the given `value`. Only intended for simple values and unnested tables.
|
||||
|
||||
- tbl: `table`
|
||||
- value: `any`
|
||||
|
||||
Return:
|
||||
- isContained: `boolean`
|
||||
|
||||
## lib.table.matches
|
||||
|
||||
@@ -13,22 +20,63 @@ lib.table.contains(table, value)
|
||||
lib.table.matches(tableOne, tableTwo)
|
||||
```
|
||||
|
||||
* tableOne: `table`.
|
||||
* tableTwo: `table`
|
||||
Compares if two values are equal, iterating over tables and matching both keys and values.
|
||||
|
||||
- tableOne: `table`
|
||||
- tableTwo: `table`
|
||||
|
||||
Return:
|
||||
- matches: `boolean`
|
||||
|
||||
## lib.table.deepclone
|
||||
|
||||
Recursively clones a table to ensure no table references remain.
|
||||
|
||||
```lua
|
||||
lib.table.deepclone(table)
|
||||
lib.table.deepclone(tbl)
|
||||
```
|
||||
|
||||
* table: `table`
|
||||
- tbl: `table`
|
||||
|
||||
Return:
|
||||
- clonedTable: `table`
|
||||
|
||||
## lib.table.merge
|
||||
|
||||
Merges two tables together. Duplicate keys will be added together if they are numbers, otherwise `tableTwo`'s value will be used.
|
||||
|
||||
```lua
|
||||
lib.table.merge(tableOne, tableTwo)
|
||||
```
|
||||
|
||||
* tableOne: `table`
|
||||
* tableTwo: `table`
|
||||
- tableOne: `table`
|
||||
- tableTwo: `table`
|
||||
|
||||
Return:
|
||||
- tableOne: `table`
|
||||
|
||||
## lib.table.freeze
|
||||
|
||||
Makes a table read-only, preventing further modification. Unfrozen tables stored within `table` are still mutable.
|
||||
|
||||
```lua
|
||||
lib.table.freeze(tbl)
|
||||
```
|
||||
|
||||
- tbl: `table`
|
||||
|
||||
Return:
|
||||
- frozenTable: `table`
|
||||
|
||||
## lib.table.isFrozen
|
||||
|
||||
Returns true if `tbl` is set as read-only.
|
||||
|
||||
```lua
|
||||
lib.table.isFrozen(tbl)
|
||||
```
|
||||
|
||||
- tbl: `table`
|
||||
|
||||
Return:
|
||||
- isFrozen: `boolean`
|
||||
@@ -9,7 +9,9 @@ import { Tabs, Tab } from 'nextra-theme-docs';
|
||||
lib.getVehicleProperties(vehicle)
|
||||
```
|
||||
|
||||
* vehicle: `entity`
|
||||
- vehicle: `number`
|
||||
- vehicle handle of the vehicle to get the properties for
|
||||
|
||||
|
||||
<Tabs items={["Lua", "JS"]}>
|
||||
<Tab>
|
||||
@@ -38,8 +40,8 @@ Requires the vehicle to belong to the client. _Do not use NetworkRequestControlO
|
||||
lib.setVehicleProperties(vehicle, props)
|
||||
```
|
||||
|
||||
* vehicle: `entity`
|
||||
* props: `table` (`object`)
|
||||
- vehicle: `entity`
|
||||
- props: `table` (`object`)
|
||||
|
||||
<Tabs items={["Lua", "JS"]}>
|
||||
<Tab>
|
||||
@@ -64,10 +66,94 @@ onNet('ox_lib:setVehicleProperties', (netid, data) => {
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
#### Recommended usage
|
||||
#### Recommended Usage
|
||||
|
||||
The server should tell the owner of the entity to set properties, using the following trigger.
|
||||
|
||||
```lua
|
||||
TriggerClientEvent('ox_lib:setVehicleProperties', entityOwner, vehNetId, data)
|
||||
```
|
||||
|
||||
### Vehicle Properties
|
||||
|
||||
- model?: `number`
|
||||
- plate?: `string`
|
||||
- plateIndex?: `number`
|
||||
- bodyHealth?: `number`
|
||||
- engineHealth?: `number`
|
||||
- tankHealth?: `number`
|
||||
- fuelLevel?: `number`
|
||||
- oilLevel?: `number`
|
||||
- dirtLevel?: `number`
|
||||
- color1?: `number` or `number[]`
|
||||
- color2?: `number` or `number[]`
|
||||
- pearlescentColor?: `number`
|
||||
- interiorColor?: `number`
|
||||
- dashboardColor?: `number`
|
||||
- wheelColor?: `number`
|
||||
- wheelWidth?: `number`
|
||||
- wheelSize?: `number`
|
||||
- wheels?: `number`
|
||||
- windowTint?: `number`
|
||||
- xenonColor?: `number`
|
||||
- neonEnabled?: `boolean[]`
|
||||
- neonColor?: `number` or `number[]`
|
||||
- extras?: `table<number | string, 0 | 1>`
|
||||
- tyreSmokeColor?: `number` or `number[]`
|
||||
- modSpoilers?: `number`
|
||||
- modFrontBumper?: `number`
|
||||
- modRearBumper?: `number`
|
||||
- modSideSkirt?: `number`
|
||||
- modExhaust?: `number`
|
||||
- modFrame?: `number`
|
||||
- modGrille?: `number`
|
||||
- modHood?: `number`
|
||||
- modFender?: `number`
|
||||
- modRightFender?: `number`
|
||||
- modRoof?: `number`
|
||||
- modEngine?: `number`
|
||||
- modBrakes?: `number`
|
||||
- modTransmission?: `number`
|
||||
- modHorns?: `number`
|
||||
- modSuspension?: `number`
|
||||
- modArmor?: `number`
|
||||
- modNitrous?: `number`
|
||||
- modTurbo?: `number`
|
||||
- modSubwoofer?: `boolean`
|
||||
- modSmokeEnabled?: `boolean`
|
||||
- modHydraulics?: `boolean`
|
||||
- modXenon?: `boolean`
|
||||
- modFrontWheels?: `number`
|
||||
- modBackWheels?: `number`
|
||||
- modCustomTiresF?: `boolean`
|
||||
- modCustomTiresR?: `boolean`
|
||||
- modPlateHolder?: `number`
|
||||
- modVanityPlate?: `number`
|
||||
- modTrimA?: `number`
|
||||
- modOrnaments?: `number`
|
||||
- modDashboard?: `number`
|
||||
- modDial?: `number`
|
||||
- modDoorSpeaker?: `number`
|
||||
- modSeats?: `number`
|
||||
- modSteeringWheel?: `number`
|
||||
- modShifterLeavers?: `number`
|
||||
- modAPlate?: `number`
|
||||
- modSpeakers?: `number`
|
||||
- modTrunk?: `number`
|
||||
- modHydrolic?: `number`
|
||||
- modEngineBlock?: `number`
|
||||
- modAirFilter?: `number`
|
||||
- modStruts?: `number`
|
||||
- modArchCover?: `number`
|
||||
- modAerials?: `number`
|
||||
- modTrimB?: `number`
|
||||
- modTank?: `number`
|
||||
- modWindows?: `number`
|
||||
- modDoorR?: `number`
|
||||
- modLivery?: `number`
|
||||
- modRoofLivery?: `number`
|
||||
- modLightbar?: `number`
|
||||
- windows?: `number[]`
|
||||
- doors?: `number[]`
|
||||
- tyres?: `table<number | string, 1 | 2>`
|
||||
- bulletProofTyres?: `boolean`
|
||||
@@ -8,7 +8,7 @@ import { Tabs, Tab } from 'nextra-theme-docs';
|
||||
lib.versionCheck(repository)
|
||||
```
|
||||
|
||||
* repository: `string`
|
||||
- repository: `string`
|
||||
|
||||
<Tabs items={["Lua", "JS"]}>
|
||||
<Tab>
|
||||
|
||||
@@ -8,8 +8,8 @@ import { Tabs, Tab } from 'nextra-theme-docs';
|
||||
lib.checkDependency(resource, version)
|
||||
```
|
||||
|
||||
* resource: `string`
|
||||
* version: `string`
|
||||
- resource: `string`
|
||||
- version: `string`
|
||||
|
||||
<Tabs items={["Lua", "JS"]}>
|
||||
<Tab>
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
import { Tabs, Tab } from 'nextra-theme-docs';
|
||||
import { Callout } from 'nextra/components';
|
||||
|
||||
Faster alternative to PolyZone utilising [glm.polygon](https://github.com/citizenfx/lua/blob/luaglm-dev/cfx/EXTENDED.md).
|
||||
|
||||
<Callout>
|
||||
|
||||
Currently zones only have basic support on the server side. Some features will not work such as `onEnter`, `onExit`, and `inside`.
|
||||
|
||||
</Callout>
|
||||
|
||||
## lib.zones.poly
|
||||
|
||||
```lua
|
||||
@@ -13,9 +20,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
|
||||
@@ -30,9 +37,9 @@ lib.zones.box(data)
|
||||
- Default: `vec3(4, 4, 4)`
|
||||
- rotation?: `number`
|
||||
- Angle in degrees
|
||||
- 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.sphere
|
||||
@@ -140,6 +147,7 @@ Zones will be saved to `ox_lib/created_zones.lua` with your chosen format.
|
||||
|
||||
<Tabs items={["function", "array", "ox_target"]}>
|
||||
<Tab>
|
||||
|
||||
```lua
|
||||
local poly = lib.zones.poly({
|
||||
name = poly,
|
||||
@@ -150,11 +158,13 @@ Zones will be saved to `ox_lib/created_zones.lua` with your chosen format.
|
||||
vec(447.2, -995.6, 25.8),
|
||||
vec(446.3, -997.9, 25.8),
|
||||
},
|
||||
thickness = 2,
|
||||
thickness = 2,
|
||||
})
|
||||
```
|
||||
|
||||
</Tab>
|
||||
<Tab>
|
||||
|
||||
```lua
|
||||
{
|
||||
name = poly,
|
||||
@@ -165,11 +175,12 @@ Zones will be saved to `ox_lib/created_zones.lua` with your chosen format.
|
||||
vec(447.2, -995.6, 25.8),
|
||||
vec(446.3, -997.9, 25.8),
|
||||
},
|
||||
thickness = 2,
|
||||
thickness = 2,
|
||||
},
|
||||
```
|
||||
</Tab>
|
||||
<Tab>
|
||||
|
||||
```lua
|
||||
exports.ox_target:addPolyZone({
|
||||
name = poly,
|
||||
@@ -180,8 +191,9 @@ Zones will be saved to `ox_lib/created_zones.lua` with your chosen format.
|
||||
vec(447.2, -995.6, 25.8),
|
||||
vec(446.3, -997.9, 25.8),
|
||||
},
|
||||
thickness = 2,
|
||||
thickness = 2,
|
||||
})
|
||||
```
|
||||
|
||||
</Tab>
|
||||
</Tabs>
|
||||
@@ -10,7 +10,7 @@ Prepare can be used to execute frequently called queries faster and accepts mult
|
||||
- TINYINT 1 and BIT will not return a boolean
|
||||
- You can only use ? value placeholders, ?? column placeholders and named placeholders will throw an error
|
||||
|
||||
Unlike [rawExecute](../rawExecute), the SELECT statement will return a column, row, or array of rows depending on the number of columns and rows selected.
|
||||
Unlike [rawExecute](./rawExecute), the SELECT statement will return a column, row, or array of rows depending on the number of columns and rows selected.
|
||||
|
||||
## Promise
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: rawExecute
|
||||
---
|
||||
|
||||
import { Tab, Tabs } from 'nextra-theme-docs';
|
||||
|
||||
rawExecute can be used to execute frequently called queries faster and accepts multiple sets of parameters to be used with a single query.
|
||||
@@ -6,7 +10,7 @@ rawExecute can be used to execute frequently called queries faster and accepts m
|
||||
- TINYINT 1 and BIT will not return a boolean
|
||||
- You can only use ? value placeholders, ?? column placeholders and named placeholders will throw an error
|
||||
|
||||
Unlike [prepare](../prepare), the SELECT statement will always return an array of rows.
|
||||
Unlike [prepare](./prepare), the SELECT statement will always return an array of rows.
|
||||
When using SELECT, the return value will match `query`, `single`, or `scalar` depending on the number of columns and rows selected.
|
||||
|
||||
## Promise
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: Common issues
|
||||
title: Common Issues
|
||||
---
|
||||
|
||||
import { Callout } from 'nextra/components';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: Using the debug UI
|
||||
title: Using the Debug UI
|
||||
---
|
||||
|
||||
import { Callout } from 'nextra/components';
|
||||
|
||||
Reference in new issue
Block a user