formatting and typos

This commit is contained in:
DokaDoka committed 2022-12-11 15:00:43 +11:00
1 parent 75698216e0
commit 724c7e356d
99 files changed
+515 -305

No files matched your search

+7 -3
View File
@@ -5,7 +5,7 @@ title: Alert Dialog
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
Simple alert dialog that can display a message to the player.
Simple alert dialog that can display a message to the player.
Returns whether the player pressed the confirm button or canceled the dialog.
### lib.alertDialog
@@ -16,6 +16,7 @@ Returns whether the player pressed the confirm button or canceled the dialog.
```lua
lib.alertDialog(data)
```
</TabItem>
<TabItem value='JS/TS'>
@@ -28,6 +29,7 @@ import lib from '@overextended/ox_lib/client'
lib.alertDialog(data)
```
</TabItem>
</Tabs>
@@ -54,6 +56,7 @@ Force closes the active alert dialog and sets its return data as `nil`
```lua
lib.closeAlertDialog()
```
</TabItem>
<TabItem value='JS/TS'>
@@ -62,6 +65,7 @@ import lib from '@overextended/ox_lib/client'
lib.closeAlertDialog()
```
</TabItem>
</Tabs>
@@ -80,6 +84,7 @@ local alert = lib.alertDialog({
print(alert)
```
</TabItem>
<TabItem value='JS/TS'>
@@ -95,9 +100,8 @@ const alert = await lib.alertDialog({
console.log(alert)
```
</TabItem>
</Tabs>
![alert_dialog](https://i.imgur.com/TnUT3S1.png)
@@ -15,6 +15,7 @@ Sets the player's clipboard to the specified string value.
```lua
lib.setClipboard(value)
```
</TabItem>
<TabItem value='JS/TS'>
@@ -23,6 +24,7 @@ import lib from '@overextended/ox_lib/client'
lib.setClipboard(value)
```
</TabItem>
</Tabs>
+22 -8
View File
@@ -6,6 +6,7 @@ import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
### lib.registerContext
Used for registering a context menu.
<Tabs>
@@ -14,6 +15,7 @@ Used for registering a context menu.
```lua
lib.registerContext(context)
```
</TabItem>
<TabItem value='JS/TS'>
@@ -22,6 +24,7 @@ import lib from '@overextended/ox_lib/client'
lib.registerContext(context)
```
</TabItem>
</Tabs>
@@ -54,7 +57,7 @@ lib.registerContext(context)
* progress?: `number`
* Adds a progress bar filled to this percentage
* colorScheme?: `string`
* Sets the color scheme of the progress bar. Current options available are:
* Sets the color scheme of the progress bar. Current options available are:
* `whiteAlpha`, `blackAlpha`, `gray`, `red`, `orange`, `yellow`, `green`, `teal`, `blue`, `cyan`, `purple`, `pink`
* arrow?: `boolean`
* Shows an arrow on the right side like `menu` does, useful when you are opening a menu from an event. Can be set to false to hide it.
@@ -74,12 +77,13 @@ lib.registerContext(context)
You can register as many context menus in one `lib.registerContext` function
as you'd like.
The menu can be either in the order you write it in, or sorted alphabetically.
The menu can be either in the order you write it in, or sorted alphabetically.
To sort the menu alphabetically the buttons (and/or metadata) need to be defined as keys,
otherwise not using keys and instead using tables will make the menu be in the order you
define it as.
### lib.showContext
Opens a registered context menu by it's id.
<Tabs>
@@ -88,6 +92,7 @@ Opens a registered context menu by it's id.
```lua
lib.showContext(id)
```
</TabItem>
<TabItem value='JS/TS'>
@@ -96,12 +101,14 @@ import lib from '@overextended/ox_lib/client'
lib.showContext(id)
```
</TabItem>
</Tabs>
* id: `string`
### lib.hideContext
Hides any currently visible context menu.
<Tabs>
@@ -110,6 +117,7 @@ Hides any currently visible context menu.
```lua
lib.hideContext(onExit)
```
</TabItem>
<TabItem value='JS/TS'>
@@ -118,6 +126,7 @@ import lib from '@overextended/ox_lib/client'
lib.hideContext(onExit)
```
</TabItem>
</Tabs>
@@ -136,6 +145,7 @@ If no context menu is open returns `nil`.
```lua
lib.getOpenContextMenu()
```
</TabItem>
<TabItem value='JS/TS'>
@@ -144,10 +154,12 @@ import lib from '@overextended/ox_lib/client'
lib.getOpenContextMenu()
```
</TabItem>
</Tabs>
### Usage Example
First we register the menu with our specified options then we call the show function in the command.
:::tip
@@ -204,9 +216,10 @@ lib.registerContext({
```lua
RegisterCommand('testcontext', function()
lib.showContext('example_menu')
lib.showContext('example_menu')
end)
```
</TabItem>
<TabItem value='JS/TS'>
@@ -266,10 +279,10 @@ RegisterCommand('testcontext', () => {
lib.showContext('example_menu')
}, false)
```
</TabItem>
</Tabs>
To trigger the event from the `Event button` and get it's data we first
need to register the event properly:
@@ -296,6 +309,7 @@ RegisterNetEvent('some_event', function(data)
lib.showContext('another_context_menu')
end)
```
</TabItem>
<TabItem value='JS/TS'>
@@ -319,6 +333,7 @@ onNet('some_event', () => {
lib.showContext('another_context_menu');
});
```
</TabItem>
</Tabs>
@@ -327,8 +342,7 @@ the event you register, in this case that argument is called `data`.
Using this event we also register a new context menu with it's own options.
By defining a `menu` param to be the id of the first menu we can get the
By defining a `menu` param to be the id of the first menu we can get the
neat back arrow button next to the menu title that will take us back.
If we have a button that does not define either event, serverEvent or menu
@@ -337,7 +351,7 @@ the button will do nothing upon being clicked.
Of course just registering the event won't do much so we need to display it
with the `lib.showContext` function, passing in the menu's id.
![menu_example](https://i.imgur.com/aJu92dv.png)
![metadata](https://i.imgur.com/kFGSlBF.png)
![menu_example](https://i.imgur.com/aJu92dv.png)
![metadata](https://i.imgur.com/kFGSlBF.png)
![event_menu](https://i.imgur.com/r0Ln4VP.png)
![example](https://i.imgur.com/dUsil3p.png)
+21 -14
View File
@@ -16,6 +16,7 @@ by setting input fields.
```lua
lib.inputDialog(heading, rows)
```
</TabItem>
<TabItem value='JS/TS'>
@@ -24,6 +25,7 @@ import lib from '@overextended/ox_lib/client'
lib.inputDialog(heading, rows)
```
</TabItem>
</Tabs>
@@ -70,7 +72,7 @@ number data type, you can use set the `type` to `number`.
If a user left an input field empty it will return `nil`.
You can also add checkboxes that will return `true` if checked and `nil` if unchecked.
You can also add checkboxes that will return `true` if checked and `nil` if unchecked.
Look at the *Advanced* example for it's usage.
:::caution
@@ -78,7 +80,6 @@ Look at the *Advanced* example for it's usage.
When using the advanced method you can define `icon` and `password` **ONLY** with type `'input'` and `'number'` and
you can define `options` **ONLY** with type `'select'`.
Doing so otherwise ***will*** result in errors.
:::
@@ -92,6 +93,7 @@ Force closes the active input dialog and sets its return data as `nil`
```lua
lib.closeInputDialog()
```
</TabItem>
<TabItem value='JS/TS'>
@@ -100,6 +102,7 @@ import lib from '@overextended/ox_lib/client'
lib.closeInputDialog()
```
</TabItem>
</Tabs>
@@ -119,6 +122,7 @@ local lockerPasscode = input[2]
print(lockerNumber, lockerPasscode)
```
</TabItem>
<TabItem value='JS/TS'>
@@ -127,7 +131,6 @@ print(lockerNumber, lockerPasscode)
This function is **asynchronous** requiring you to do a `.then` callback on the promise or make your function `async`.
:::
```ts
const input = await lib.inputDialog('Police locker', ['Locker number', 'Locker passcode'])
@@ -137,6 +140,7 @@ const lockerPasscode = input[1] as number
console.log(lockerNumber, lockerPasscode)
```
</TabItem>
</Tabs>
@@ -149,19 +153,21 @@ console.log(lockerNumber, lockerPasscode)
```lua
local input = lib.inputDialog('Police locker', {
{ type = "input", label = "Locker number", placeholder = "123" },
{ type = "checkbox", label = "Some checkbox" },
{ type = "input", label = "Locker PIN", password = true, icon = 'lock' },
{ type = "checkbox", label = "Some other checkbox", checked = true },
{ type = 'select', label = 'Value select', options = {
{ value = 'option1', label = 'Option 1' },
{ value = 'option2', label = 'Option 2' },
{ value = 'option3', label = 'Option 3'},
}},
{ type = "number", label = "Number counter", default = 12 }
{ type = "input", label = "Locker number", placeholder = "123" },
{ type = "checkbox", label = "Some checkbox" },
{ type = "input", label = "Locker PIN", password = true, icon = 'lock' },
{ type = "checkbox", label = "Some other checkbox", checked = true },
{ type = 'select', label = 'Value select', options = {
{ value = 'option1', label = 'Option 1' },
{ value = 'option2', label = 'Option 2' },
{ value = 'option3', label = 'Option 3'},
}},
{ type = "number", label = "Number counter", default = 12 }
})
print(json.encode(input, {indent=true}))
```
</TabItem>
<TabItem value="JS/TS">
@@ -185,7 +191,8 @@ const input = await lib.inputDialog('Police locker', [
]);
console.log(JSON.stringify(input, null, 2));
```
```
</TabItem>
</Tabs>
+21 -8
View File
@@ -8,6 +8,7 @@ import TabItem from '@theme/TabItem';
Keyboard navigation menu with specific event functions.
### lib.registerMenu
Registers and caches a menu under the specified id.
<Tabs>
@@ -16,6 +17,7 @@ Registers and caches a menu under the specified id.
```lua
lib.registerMenu(data, cb)
```
</TabItem>
<TabItem value='JS/TS'>
@@ -24,6 +26,7 @@ import lib from '@overextended/ox_lib/client'
lib.registerMenu(data, cb)
```
</TabItem>
</Tabs>
@@ -37,7 +40,7 @@ lib.registerMenu(data, cb)
* icon?: `string`
* iconColor?: `string`
* values?: `table` (`Array<string | {label: string; description: string}>`)
* If provided creates a side scrollabel list.
* If provided creates a side scrollable list.
* When using object and setting description, the set description will be displayed in the menu tooltip.
* checked?: `boolean`
* Setting either true or false will make the button a checkbox, if `values` is also provided the button will be a
@@ -61,7 +64,7 @@ lib.registerMenu(data, cb)
* onClose: `function`(keyPressed?: `'Escape' | 'Backspace'`)
* Function that runs when the menu is exited via ESC/Backspace.
* onSelected: `function`(selected: `number`, secondary: `number` | `boolean`, args: {[key: `string`]: `any`})
* Function being ran when the selected button in the menu changes.
* Function being ran when the selected button in the menu changes.
* onSideScroll: `function`(selected: `number`, scrollIndex: `number`, args: {[key: `string`]: `any`})
* Function ran whenever a scroll list item is changed.
* onCheck: `function`(selected: `number`, checked: `boolean`, args: {[key: `string`]: `any`})
@@ -69,8 +72,8 @@ lib.registerMenu(data, cb)
* Callback function when the menu item is pressed.
### lib.showMenu
Displays the menu with the provided id.
Displays the menu with the provided id.
<Tabs>
<TabItem value='Lua'>
@@ -78,6 +81,7 @@ Displays the menu with the provided id.
```lua
lib.showMenu(id)
```
</TabItem>
<TabItem value='JS/TS'>
@@ -86,13 +90,12 @@ import lib from '@overextended/ox_lib/client'
lib.showMenu(id)
```
</TabItem>
</Tabs>
* id: `string`
### lib.hideMenu
<Tabs>
@@ -101,6 +104,7 @@ lib.showMenu(id)
```lua
lib.hideMenu(onExit)
```
</TabItem>
<TabItem value='JS/TS'>
@@ -109,6 +113,7 @@ import lib from '@overextended/ox_lib/client'
lib.hideMenu(onExit)
```
</TabItem>
</Tabs>
@@ -116,6 +121,7 @@ lib.hideMenu(onExit)
* If true runs the menu's `onClose` function.
### lib.getOpenMenu
Returns the id of the currently open menu.
<Tabs>
@@ -124,6 +130,7 @@ Returns the id of the currently open menu.
```lua
lib.getOpenMenu()
```
</TabItem>
<TabItem value='JS/TS'>
@@ -132,10 +139,10 @@ import lib from '@overextended/ox_lib/client'
lib.getOpenMenu()
```
</TabItem>
</Tabs>
### lib.setMenuOptions
<Tabs>
@@ -144,6 +151,7 @@ lib.getOpenMenu()
```lua
lib.setMenuOptions(id, options, index)
```
</TabItem>
<TabItem value='JS/TS'>
@@ -152,6 +160,7 @@ import lib from '@overextended/ox_lib/client'
lib.setMenuOptions(id, options, index)
```
</TabItem>
</Tabs>
@@ -170,6 +179,7 @@ Replaces the 3rd index option of the specified menu
```lua
lib.setMenuOptions('some_menu_id', {label = 'New option', icon = 'plus'}, 3)
```
</TabItem>
<TabItem value='JS/TS'>
@@ -178,17 +188,18 @@ import lib from '@overextended/ox_lib/client'
lib.setMenuOptions('some_menu_id', {label: 'New option', icon: 'plus'}, 3)
```
</TabItem>
</Tabs>
### Usage Example
First we register the menu with our specified options then we call the show function in the command.
First we register the menu with our specified options then we call the show function in the command.
:::tip
Avoid constantly re-registering a menu that does not depend on any outside values (A.K.A a static menu).
:::
<Tabs>
<TabItem value='Lua'>
@@ -240,6 +251,7 @@ RegisterCommand('testmenu', function()
lib.showMenu('some_menu_id')
end)
```
</TabItem>
<TabItem value='JS/TS'>
@@ -293,6 +305,7 @@ RegisterCommand('testmenu', () => {
lib.showMenu('some_menu_id')
}, false)
```
</TabItem>
</Tabs>
+16 -6
View File
@@ -6,6 +6,7 @@ import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
## lib.notify
Custom notifications with a lot of styling options.
<Tabs>
@@ -14,6 +15,7 @@ Custom notifications with a lot of styling options.
```lua
lib.notify(data)
```
</TabItem>
<TabItem value='JS/TS'>
@@ -22,6 +24,7 @@ import lib from '@overextended/ox_lib/client'
lib.notify(data)
```
</TabItem>
</Tabs>
@@ -44,7 +47,7 @@ lib.notify(data)
### Usage Example
### Standard
#### Standard
<Tabs>
<TabItem value='Lua'>
@@ -56,6 +59,7 @@ lib.notify({
type = 'success'
})
```
</TabItem>
<TabItem value='JS/TS'>
@@ -68,12 +72,13 @@ lib.notify({
type: 'success'
})
```
</TabItem>
</Tabs>
![notification](https://i.imgur.com/cRxJICO.png)
### Custom
#### Custom
<Tabs>
<TabItem value='Lua'>
@@ -92,6 +97,7 @@ lib.notify({
iconColor = '#C53030'
})
```
</TabItem>
<TabItem value='JS/TS'>
@@ -111,13 +117,14 @@ lib.notify({
iconColor: '#C53030'
})
```
</TabItem>
</Tabs>
![custom_notification](https://i.imgur.com/0EK5APp.png)
## lib.defaultNotify
Default notifications provided by Chakra UI.
<Tabs>
@@ -126,6 +133,7 @@ Default notifications provided by Chakra UI.
```lua
lib.defaultNotify(data)
```
</TabItem>
<TabItem value='JS/TS'>
@@ -134,17 +142,17 @@ import lib from '@overextended/ox_lib/client'
lib.defaultNotify(data)
```
</TabItem>
</Tabs>
* id?: `number`
* Same as id in `lib.notify`
* title?: `string`
* description?: `string`
* description?: `string`
* duration?: `number`
* position?: `'top'` or `'top-right'` or `'top-left'` or `'bottom'` or `'bottom-right'` or `'bottom-left'`
* status?: `'info'` or `'warning'` or `'success'` or `'error'`
* status?: `'info'` or `'warning'` or `'success'` or `'error'`
### Usage Example
@@ -158,6 +166,7 @@ lib.defaultNotify({
status = 'success'
})
```
</TabItem>
<TabItem value='JS/TS'>
@@ -170,6 +179,7 @@ lib.defaultNotify({
status: 'success'
})
```
</TabItem>
</Tabs>
+23 -9
View File
@@ -6,6 +6,7 @@ import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
## lib.progressBar
Displays a running progress bar.
<Tabs>
@@ -14,6 +15,7 @@ Displays a running progress bar.
```lua
lib.progressBar(data)
```
</TabItem>
<TabItem value='JS/TS'>
@@ -22,6 +24,7 @@ import lib from '@overextended/ox_lib/client'
lib.progressBar(data)
```
</TabItem>
</Tabs>
@@ -88,15 +91,16 @@ if lib.progressBar({
},
anim = {
dict = 'mp_player_intdrink',
clip = 'loop_bottle'
clip = 'loop_bottle'
},
prop = {
model = `prop_ld_flow_bottle`,
pos = vec3(0.03, 0.03, 0.02),
rot = vec3(0.0, 0.0, -1.5)
rot = vec3(0.0, 0.0, -1.5)
},
}) then print('Do stuff when complete') else print('Do stuff when cancelled') end
```
</TabItem>
<TabItem value='JS/TS'>
@@ -117,22 +121,24 @@ if (await lib.progressBar({
},
anim: {
dict: 'mp_player_intdrink',
clip: 'loop_bottle'
clip: 'loop_bottle'
},
prop: {
model: `prop_ld_flow_bottle`,
pos: {x: 0.03, y: 0.03, z: 0.02},
rot: {x: 0.0, y: 0.0, z: -1.5}
rot: {x: 0.0, y: 0.0, z: -1.5}
},
})) console.log('Do stuff when complete');
else console.log('Do stuff when cancelled')
```
</TabItem>
</Tabs>
![progress_bar](https://i.imgur.com/7pAwktr.png)
## lib.progressCircle
Similar to `lib.progressBar` except it displays a circle and you can define a position.
<Tabs>
@@ -141,6 +147,7 @@ Similar to `lib.progressBar` except it displays a circle and you can define a po
```lua
lib.progressCircle(data)
```
</TabItem>
<TabItem value='JS/TS'>
@@ -149,6 +156,7 @@ import lib from '@overextended/ox_lib/client'
lib.progressCircle(data)
```
</TabItem>
</Tabs>
@@ -217,15 +225,16 @@ if lib.progressCircle({
},
anim = {
dict = 'mp_player_intdrink',
clip = 'loop_bottle'
clip = 'loop_bottle'
},
prop = {
model = `prop_ld_flow_bottle`,
pos = vec3(0.03, 0.03, 0.02),
rot = vec3(0.0, 0.0, -1.5)
rot = vec3(0.0, 0.0, -1.5)
},
}) then print('Do stuff when complete') else print('Do stuff when cancelled') end
```
</TabItem>
<TabItem value='JS/TS'>
@@ -246,7 +255,7 @@ if (await lib.progressCircle({
},
anim: {
dict: 'mp_player_intdrink',
clip: 'loop_bottle'
clip: 'loop_bottle'
},
prop: {
model: `prop_ld_flow_bottle`,
@@ -256,12 +265,14 @@ if (await lib.progressCircle({
})) console.log('Do stuff when complete')
else console.log('Do stuff when cancelled')
```
</TabItem>
</Tabs>
![progress_circle](https://i.imgur.com/nETRm5f.png)
## lib.progressActive
Returns true if a progress bar is currently active.
<Tabs>
@@ -270,6 +281,7 @@ Returns true if a progress bar is currently active.
```lua
lib.progressActive()
```
</TabItem>
<TabItem value='JS/TS'>
@@ -278,11 +290,12 @@ import lib from '@overextended/ox_lib/client'
lib.progressActive()
```
</TabItem>
</Tabs>
## lib.cancelProgress
If there is a progress bar active and the
progress bar can be cancelled then it cancels it.
@@ -292,6 +305,7 @@ progress bar can be cancelled then it cancels it.
```lua
lib.cancelProgress()
```
</TabItem>
<TabItem value='JS/TS'>
@@ -300,6 +314,6 @@ import lib from '@overextended/ox_lib/client'
lib.cancelProgress()
```
</TabItem>
</Tabs>
+6 -2
View File
@@ -15,6 +15,7 @@ Runs a skill check with the defined difficulty.
```lua
lib.skillCheck(difficulty)
```
</TabItem>
<TabItem value='JS/TS'>
@@ -23,10 +24,11 @@ import lib from '@overextended/ox_lib/client'
lib.skillCheck(difficulty)
```
</TabItem>
</Tabs>
* difficulty: `easy` or `medium` or `hard` or `object`
* 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 }
@@ -43,6 +45,7 @@ lib.skillCheck(difficulty)
```lua
local success = lib.skillCheck({'easy', 'easy', {areaSize = 60, speedMultiplier = 2}, 'hard'})
```
</TabItem>
<TabItem value='JS/TS'>
@@ -51,7 +54,8 @@ import lib from '@overextended/ox_lib/client'
const success = await lib.skillCheck(['easy', 'easy', {areaSize: 60, speedMultiplier: 2}, 'hard'])
```
</TabItem>
</Tabs>
![Image](https://i.imgur.com/RWSWZ1I.png)
![skillcheck_example](https://i.imgur.com/RWSWZ1I.png)
+14 -7
View File
@@ -6,9 +6,10 @@ import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
## lib.showTextUI
Show the TextUI window.
**DO NOT** run this every tick, it's intented to be used as a toggle.
**DO NOT** run this every tick, it's intended to be used as a toggle.
<Tabs>
<TabItem value='Lua'>
@@ -16,6 +17,7 @@ Show the TextUI window.
```lua
lib.showTextUI(text, options)
```
</TabItem>
<TabItem value='JS/TS'>
@@ -24,11 +26,12 @@ import lib from '@overextended/ox_lib/client'
lib.showTextUI(text, options)
```
</TabItem>
</Tabs>
* text: `string`
* options?: `table`
* options?: `table`
* position?: `'right-center'` or `'left-center'` or `'top-center'`
* Default: `'right-center'`
* icon?: `string` or `table` (`array`)
@@ -45,6 +48,7 @@ lib.showTextUI(text, options)
```lua
lib.showTextUI('[E] - Fuel vehicle')
```
</TabItem>
<TabItem value='JS/TS'>
@@ -53,10 +57,11 @@ import lib from '@overextended/ox_lib/client'
lib.showTextUI('[E] - Fuel vehicle')
```
</TabItem>
</Tabs>
![](https://i.imgur.com/3ptQyAq.png)
![basic_example](https://i.imgur.com/3ptQyAq.png)
### Custom styling
@@ -74,6 +79,7 @@ lib.showTextUI('[E] - Pick apple', {
}
})
```
</TabItem>
<TabItem value='JS/TS'>
@@ -90,13 +96,14 @@ lib.showTextUI('[E] - Pick apple', {
}
})
```
</TabItem>
</Tabs>
![](https://i.imgur.com/gNDwPBN.png)
![custom_example](https://i.imgur.com/gNDwPBN.png)
### lib.hideTextUI
Hides the currently visible TextUI window
<Tabs>
@@ -105,6 +112,7 @@ Hides the currently visible TextUI window
```lua
lib.hideTextUI()
```
</TabItem>
<TabItem value='JS/TS'>
@@ -113,7 +121,6 @@ import lib from '@overextended/ox_lib/client'
lib.hideTextUI()
```
</TabItem>
</Tabs>