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:
Jag authored and GitHub committed 2023-07-03 13:13:56 +10:00
1 parent 7495414c9c
commit 74227cc262
39 files changed
+533 -247

No files matched your search

@@ -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>