mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-01 22:21:48 +00:00
formatting and typos
This commit is contained in:
1 parent
75698216e0
commit
724c7e356d
99 files changed
+515
-305
No files matched your search
@@ -1,11 +1,11 @@
|
||||
Wrapper around the built-in ACL system. Handles lib.addCommand and ox_groups permissions.
|
||||
Wrapper around the built-in ACL system. Handles lib.addCommand and ox_groups permissions.
|
||||
Refer to [Basic Aces & Principals overview/guide](https://forum.cfx.re/t/basic-aces-principals-overview-guide/90917) for more information.
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
|
||||
### lib.addAce
|
||||
|
||||
Assigns the ace permission to a principal. Third parameter defaults to 'allow', while false sets the permission to 'deny'.
|
||||
|
||||
<Tabs>
|
||||
@@ -16,6 +16,7 @@ lib.addAce(principal, ace, allow)
|
||||
|
||||
lib.addAce('group.admin', 'command.say')
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value='JS/TS'>
|
||||
|
||||
@@ -26,25 +27,27 @@ lib.addAce(principal, ace, allow)
|
||||
|
||||
lib.addAce('group.admin', 'command.say')
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
* principal: `string`
|
||||
* ace: `string`
|
||||
* principal: `string`
|
||||
* ace: `string`
|
||||
* allow: `boolean`
|
||||
|
||||
### lib.removeAce
|
||||
|
||||
Removes the ace permission from a principal. Third parameter defaults to 'allow', while false sets the permission to 'deny'.
|
||||
|
||||
<Tabs>
|
||||
<TabItem value='Lua'>
|
||||
|
||||
|
||||
```lua
|
||||
lib.removeAce(principal, ace, allow)
|
||||
|
||||
lib.removeAce('group.admin', 'command.say')
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value='JS/TS'>
|
||||
|
||||
@@ -55,14 +58,16 @@ lib.removeAce(principal, ace, allow)
|
||||
|
||||
lib.removeAce('group.admin', 'command.say')
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
* principal: `string`
|
||||
* ace: `string`
|
||||
* principal: `string`
|
||||
* ace: `string`
|
||||
* allow: `boolean`
|
||||
|
||||
### lib.addPrincipal
|
||||
|
||||
Assigns a principal to a parent principal. Children inherit permissions from the parent.
|
||||
|
||||
<Tabs>
|
||||
@@ -73,6 +78,7 @@ lib.addPrincipal(child, parent)
|
||||
|
||||
lib.addPrincipal('player.1', 'group.moderator')
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value='JS/TS'>
|
||||
|
||||
@@ -83,14 +89,15 @@ lib.addPrincipal(child, parent)
|
||||
|
||||
lib.addPrincipal('player.1', 'group.moderator')
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
* child: `string`
|
||||
* parent: `string`
|
||||
|
||||
|
||||
### lib.removePrincipal
|
||||
|
||||
Removes a principal from a parent principal.
|
||||
|
||||
<Tabs>
|
||||
@@ -101,6 +108,7 @@ lib.removePrincipal(child, parent)
|
||||
|
||||
lib.removePrincipal('player.1', 'group.moderator')
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value='JS/TS'>
|
||||
|
||||
@@ -111,9 +119,9 @@ lib.removePrincipal(child, parent)
|
||||
|
||||
lib.removePrincipal('player.1', 'group.moderator')
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
* child: `string`
|
||||
* parent: `string`
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
```lua
|
||||
lib.addCommand(principal, command, callback, parameters, help)
|
||||
```
|
||||
|
||||
* principal: `string` or `string[]` or `false`
|
||||
* command: `string`
|
||||
* callback: `function`
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
```lua
|
||||
lib.addKeybind(data)
|
||||
```
|
||||
|
||||
* data: `table`
|
||||
* name: `string`
|
||||
* description: `string`
|
||||
@@ -27,7 +28,8 @@ local keybind = lib.addKeybind({
|
||||
```
|
||||
|
||||
Keybinds can be enabled/disabled by using the disable method.
|
||||
|
||||
```lua
|
||||
keybind:disable(true) -- disable
|
||||
keybind:disable(false) -- enable
|
||||
```
|
||||
```
|
||||
@@ -1,7 +1,7 @@
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
Caches data related to the player and handling some events or statebags.
|
||||
Caches data related to the player and handling some events or statebags.
|
||||
An interval runs every 100ms to update data that cannot be checked via handlers.
|
||||
|
||||
## States
|
||||
|
||||
@@ -51,7 +51,7 @@ lib.callback.register(name, cb)
|
||||
|
||||
```lua
|
||||
lib.callback.register('ox:getNearbyVehicles', function(radius)
|
||||
local nearbyVehicles = lib.getNearbyVehicles(GetEntityCoords(cache.ped), radius, true)
|
||||
return nearbyVehicles
|
||||
local nearbyVehicles = lib.getNearbyVehicles(GetEntityCoords(cache.ped), radius, true)
|
||||
return nearbyVehicles
|
||||
end)
|
||||
```
|
||||
@@ -1,23 +1,31 @@
|
||||
### lib.disableControls
|
||||
|
||||
Call on frame to disable all stored keys.
|
||||
|
||||
```lua
|
||||
lib.disableControls()
|
||||
```
|
||||
|
||||
### lib.disableControls:Add
|
||||
|
||||
```lua
|
||||
lib.disableControls:Add(...)
|
||||
```
|
||||
|
||||
* vararg: `number`
|
||||
|
||||
### lib.disableControls:Remove
|
||||
|
||||
```lua
|
||||
lib.disableControls:Remove(...)
|
||||
```
|
||||
|
||||
* vararg: `number`
|
||||
|
||||
### lib.disableControls:Clear
|
||||
|
||||
```lua
|
||||
lib.disableControls:Clear(...)
|
||||
```
|
||||
|
||||
* vararg: `number`
|
||||
@@ -5,6 +5,7 @@ Get the id, ped, and coords of the closest player to a set of coordinates.
|
||||
```lua
|
||||
function lib.getClosestPlayer(coords, maxDistance, includePlayer) end
|
||||
```
|
||||
|
||||
* coords: `vector3`
|
||||
* The coords to check from.
|
||||
* maxDistance: `number`
|
||||
@@ -13,6 +14,7 @@ function lib.getClosestPlayer(coords, maxDistance, includePlayer) end
|
||||
* Whether or not to include the current player.
|
||||
|
||||
Return:
|
||||
|
||||
* playerId?: `number`
|
||||
* playerPed?: `number`
|
||||
* playerCoords?: `vector3`
|
||||
@@ -14,5 +14,6 @@ function lib.getClosestVehicle(coords, maxDistance, includePlayerVehicle) end
|
||||
* Whether or not to include the player's current vehicle.
|
||||
|
||||
Return:
|
||||
|
||||
* vehicle?: `number`
|
||||
* vehicleCoords?: `vector3`
|
||||
@@ -5,6 +5,7 @@ Get the id, ped, and coords of all players within range of a set of coordinates.
|
||||
```lua
|
||||
function lib.getNearbyPlayers(coords, maxDistance, includePlayer) end
|
||||
```
|
||||
|
||||
* coords: `vector3`
|
||||
* The coords to check from.
|
||||
* maxDistance: `number`
|
||||
@@ -13,4 +14,5 @@ function lib.getNearbyPlayers(coords, maxDistance, includePlayer) end
|
||||
* Whether or not to include the current player.
|
||||
|
||||
Return:
|
||||
|
||||
* `number[]`
|
||||
@@ -5,6 +5,7 @@ Get the id and coords of all vehicles within range of a set of coordinates.
|
||||
```lua
|
||||
function lib.getNearbyVehicles(coords, maxDistance, includePlayerVehicle) end
|
||||
```
|
||||
|
||||
* coords: `vector3`
|
||||
* The coords to check from.
|
||||
* maxDistance: `number`
|
||||
@@ -13,4 +14,5 @@ function lib.getNearbyVehicles(coords, maxDistance, includePlayerVehicle) end
|
||||
* Whether or not to include the player's current vehicle.
|
||||
|
||||
Return:
|
||||
|
||||
* `number[]`
|
||||
@@ -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>
|
||||
|
||||
|
||||
|
||||

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

|
||||

|
||||

|
||||

|
||||

|
||||

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

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

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

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

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

|
||||

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

|
||||

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

|
||||
|
||||

|
||||
|
||||
### 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>
|
||||
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
Allows servers to set a preferred language and attempt to load locale files in any resources using the module.
|
||||
Allows servers to set a preferred language and attempt to load locale files in any resources using the module.
|
||||
Locale files should use the [ISO Language Code](http://www.lingoes.net/en/translator/langcode.htm) and be saved as `./locales/langcode.json`
|
||||
|
||||
To change the preferred language from English, add the convar to your server.cfg
|
||||
```cfg
|
||||
|
||||
```yaml
|
||||
setr ox:locale en
|
||||
```
|
||||
|
||||
Initialise the locale module in your resource (once).
|
||||
|
||||
```lua
|
||||
lib.locale()
|
||||
```
|
||||
|
||||
Format your strings with the new locale global.
|
||||
|
||||
```lua
|
||||
locale(str, ...)
|
||||
```
|
||||
@@ -26,8 +29,8 @@ Additional arguments can be sent to format the locale output.
|
||||
lib.locale()
|
||||
|
||||
SetInterval(function()
|
||||
print(locale('grand_theft_auto'))
|
||||
print(locale('suspect_sex', locale('male')))
|
||||
print(locale('grand_theft_auto'))
|
||||
print(locale('suspect_sex', locale('male')))
|
||||
end, 5000)
|
||||
```
|
||||
|
||||
@@ -51,6 +54,6 @@ end, 5000)
|
||||
|
||||
```lua title="fxmanifest.lua"
|
||||
files {
|
||||
'locales/*.json'
|
||||
'locales/*.json'
|
||||
}
|
||||
```
|
||||
@@ -1,12 +1,14 @@
|
||||
## Submit logs to Datadog
|
||||
|
||||
Register an account with [datadog](https://www.datadoghq.com/). Once registered you need to create an [API key](https://app.datadoghq.com/organization-settings/api-keys).
|
||||
Register an account with [datadog](https://www.datadoghq.com/). Once registered you need to create an [API key](https://app.datadoghq.com/organization-settings/api-keys).
|
||||
Modify your `server.cfg` with the newly generated API key and [intake server](https://docs.datadoghq.com/api/latest/logs/#send-logs).
|
||||
|
||||
- datadoghq.com
|
||||
- us3.datadoghq.com
|
||||
- us5.datadoghq.com
|
||||
- datadoghq.eu
|
||||
```
|
||||
|
||||
```yaml
|
||||
set datadog:key "yourapikey"
|
||||
set datadog:site "datadoghq.com"
|
||||
```
|
||||
@@ -14,14 +16,14 @@ set datadog:site "datadoghq.com"
|
||||
```lua
|
||||
lib.logger(source, event, message, ...)
|
||||
```
|
||||
* source: `string` or `number`
|
||||
* event: `string`
|
||||
* message: `string`
|
||||
* ...: `string`
|
||||
|
||||
- source: `string` or `number`
|
||||
- event: `string`
|
||||
- message: `string`
|
||||
- ...: `string`
|
||||
|
||||
Source is passed to ddsource and creates a tag. Could be playerId, identifier, -1, or server.
|
||||
Event is passed to ddservice and displays in the logs list.
|
||||
Source is passed to `ddsource` and creates a tag. Could be playerId, identifier, -1, or server.
|
||||
Event is passed to `ddservice` and displays in the logs list.
|
||||
Additional arguments are converted into tags for additional filtering and search options.
|
||||
|
||||
```lua
|
||||
@@ -61,13 +63,13 @@ Once registered with Grafana Cloud, head to [My Account](https://grafana.com/aut
|
||||
|
||||
To setup a grafana instance you'll require 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.
|
||||
|
||||
[*] Please note: By default self-hosted loki instances do not provide any authenication layers and will require an external authentication layer such as NGINX basic auth or Cloudflare Access.
|
||||
[*] Please note: By default self-hosted loki instances do not provide any authentication layers and will require an external authentication layer such as NGINX basic auth or Cloudflare Access.
|
||||
|
||||
#### Setting up Server Config
|
||||
|
||||
Open your server.cfg and if you have previously used datadog logging, change the `ox:logger` tag to be loki if not add the following tags to your cfg.
|
||||
|
||||
```
|
||||
```yaml
|
||||
set ox:logger "loki"
|
||||
set loki:user "<insert your user>"
|
||||
set loki:key "<insert the api key or password>"
|
||||
@@ -76,7 +78,7 @@ set loki:endpoint "<insert loki url without http:// or https://>"
|
||||
|
||||
Here is an example
|
||||
|
||||
```
|
||||
```yaml
|
||||
set ox:logger "loki"
|
||||
set loki:user "1337"
|
||||
set loki:key "alongcomplicatedsecurepassword"
|
||||
@@ -89,4 +91,4 @@ The data can be inserted into Loki the same way as datadog so you can follow the
|
||||
|
||||
#### Browsing Data
|
||||
|
||||
If you're unfamiliar with how to use Loki please follow an online guide or a youtube video. You can get quite indepth with what you can do, you can even track metrics and economic health all from logs.
|
||||
If you're unfamiliar with how to use Loki please follow an online guide or a youtube video. You can get quite in-depth with what you can do, you can even track metrics and economic health all from logs.
|
||||
@@ -1,10 +1,11 @@
|
||||
# Points
|
||||
|
||||
Simple and centralised distance checking, supporting callbacks when entering, leaving, and standing in-range of set coordinates.
|
||||
Simple and centralised distance checking, supporting callbacks when entering, leaving, and standing in-range of set coordinates.
|
||||
|
||||
```lua
|
||||
lib.points.new(coords, distance, data)
|
||||
```
|
||||
|
||||
* coords: `vector3`
|
||||
* distance: `number`
|
||||
* data: `table`
|
||||
@@ -33,6 +34,7 @@ end
|
||||
```
|
||||
|
||||
Points can be deleted by using the remove method.
|
||||
|
||||
```lua
|
||||
point:remove()
|
||||
```
|
||||
@@ -5,12 +5,14 @@ Starts a shapetest originating from the camera, extending to ~10m.
|
||||
```lua
|
||||
function lib.raycast.cam(flags, p8) end
|
||||
```
|
||||
|
||||
* flags?: `number`
|
||||
* Defaults to 1|2|8|16 (see: https://docs.fivem.net/natives/?_0x377906D8A31E5586)
|
||||
* p8?: `number`
|
||||
* A bit mask with bits 1, 2, 4, or 7 relating to collider types. 4 and 7 are usually used.
|
||||
|
||||
Return:
|
||||
|
||||
* hit: `boolean`
|
||||
* entityHit: `number`
|
||||
* endCoords: `vector3`
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Check if assets exist, such as models, and loads them into memory.
|
||||
Check if assets exist, such as models, and loads them into memory.
|
||||
Throws errors for invalid assets and returns true if the asset is loaded.
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
@@ -12,6 +12,7 @@ import TabItem from '@theme/TabItem';
|
||||
```lua
|
||||
lib.requestAnimDict(dict, timeout)
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value='JS/TS'>
|
||||
|
||||
@@ -20,6 +21,7 @@ import lib from '@overextended/ox_lib/client'
|
||||
|
||||
lib.requestAnimDict(dict, timeout)
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
@@ -27,7 +29,6 @@ lib.requestAnimDict(dict, timeout)
|
||||
* timeout: `number`
|
||||
* Default: `100`
|
||||
|
||||
|
||||
### lib.requestAnimSet
|
||||
|
||||
<Tabs>
|
||||
@@ -36,6 +37,7 @@ lib.requestAnimDict(dict, timeout)
|
||||
```lua
|
||||
lib.requestAnimSet(set, timeout)
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value='JS/TS'>
|
||||
|
||||
@@ -44,6 +46,7 @@ import lib from '@overextended/ox_lib/client'
|
||||
|
||||
lib.requestAnimSet(set, timeout)
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
@@ -59,6 +62,7 @@ lib.requestAnimSet(set, timeout)
|
||||
```lua
|
||||
lib.requestModel(model, timeout)
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value='JS/TS'>
|
||||
|
||||
@@ -67,6 +71,7 @@ import lib from '@overextended/ox_lib/client'
|
||||
|
||||
lib.requestModel(model, timeout)
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
@@ -74,7 +79,6 @@ lib.requestModel(model, timeout)
|
||||
* timeout: `number`
|
||||
* Default: `100`
|
||||
|
||||
|
||||
### lib.requestStreamedTextureDict
|
||||
|
||||
<Tabs>
|
||||
@@ -83,6 +87,7 @@ lib.requestModel(model, timeout)
|
||||
```lua
|
||||
lib.requestStreamedTextureDict(dict, timeout)
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value='JS/TS'>
|
||||
|
||||
@@ -91,6 +96,7 @@ import lib from '@overextended/ox_lib/client'
|
||||
|
||||
lib.requestStreamedTextureDict(dict, timeout)
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
@@ -98,7 +104,6 @@ lib.requestStreamedTextureDict(dict, timeout)
|
||||
* timeout: `number`
|
||||
* Default: `100`
|
||||
|
||||
|
||||
### lib.requestNamedPtfxAsset
|
||||
|
||||
<Tabs>
|
||||
@@ -106,8 +111,8 @@ lib.requestStreamedTextureDict(dict, timeout)
|
||||
|
||||
```lua
|
||||
lib.requestNamedPtfxAsset(fxName, timeout)
|
||||
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value='JS/TS'>
|
||||
|
||||
@@ -116,10 +121,10 @@ import lib from '@overextended/ox_lib/client'
|
||||
|
||||
lib.requestNamedPtfxAsset(fxName, timeout)
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
* fxName: `string`
|
||||
* timeout: `number`
|
||||
* Default: `100`
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Mostly follows the format used by ESX and QBCore, with extra data such as damaged/missing props.
|
||||
Mostly follows the format used by ESX and QBCore, with extra data such as damaged/missing props.
|
||||
https://github.com/overextended/ox_lib/blob/master/resource/vehicleProperties/client.lua#L5
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
@@ -6,10 +6,10 @@ import TabItem from '@theme/TabItem';
|
||||
|
||||
### lib.getVehicleProperties
|
||||
|
||||
|
||||
```ts
|
||||
lib.getVehicleProperties(vehicle)
|
||||
```
|
||||
|
||||
* vehicle: `entity`
|
||||
|
||||
<Tabs>
|
||||
@@ -18,6 +18,7 @@ lib.getVehicleProperties(vehicle)
|
||||
```lua
|
||||
lib.getVehicleProperties(GetVehiclePedIsUsing(PlayerPedId()))
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value='JS/TS'>
|
||||
|
||||
@@ -26,16 +27,18 @@ import lib from '@overextended/ox_lib/client'
|
||||
|
||||
lib.getVehicleProperties(GetVehiclePedIsUsing(PlayerPedId()))
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
### lib.setVehicleProperties
|
||||
|
||||
Requires the vehicle to belong to the client. _Do not use NetworkRequestControlOfEntity_.
|
||||
|
||||
```lua
|
||||
lib.setVehicleProperties(vehicle, props)
|
||||
```
|
||||
|
||||
* vehicle: `entity`
|
||||
* props: `table` (`object`)
|
||||
|
||||
@@ -47,6 +50,7 @@ RegisterNetEvent('ox_lib:setVehicleProperties', function(netid, data)
|
||||
lib.setVehicleProperties(NetToVeh(netid), data)
|
||||
end)
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value='JS/TS'>
|
||||
|
||||
@@ -57,13 +61,14 @@ onNet('ox_lib:setVehicleProperties', (netid, data) => {
|
||||
lib.setVehicleProperties(NetToVeh(netid), data)
|
||||
})
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
#### 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)
|
||||
```
|
||||
@@ -1,5 +1,6 @@
|
||||
### lib.versionCheck
|
||||
Compares the resource version to the latest published release on GitHub.
|
||||
|
||||
Compares the resource version to the latest published release on GitHub.
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
@@ -7,6 +8,7 @@ import TabItem from '@theme/TabItem';
|
||||
```lua
|
||||
lib.versionCheck(repository)
|
||||
```
|
||||
|
||||
* repository: `string`
|
||||
|
||||
<Tabs>
|
||||
@@ -15,6 +17,7 @@ lib.versionCheck(repository)
|
||||
```lua
|
||||
lib.versionCheck('overextended/ox_lib')
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value='JS/TS'>
|
||||
|
||||
@@ -23,6 +26,7 @@ import lib from '@overextended/ox_lib/server'
|
||||
|
||||
lib.versionCheck('overextended/ox_lib')
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
### lib.checkDependency
|
||||
|
||||
Check if a resource is using a specified version or higher, allowing for compatibility checks or throwing errors.
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
@@ -7,6 +8,7 @@ import TabItem from '@theme/TabItem';
|
||||
```lua
|
||||
lib.checkDependency(resource, version)
|
||||
```
|
||||
|
||||
* resource: `string`
|
||||
* version: `string`
|
||||
|
||||
@@ -16,6 +18,7 @@ lib.checkDependency(resource, version)
|
||||
```lua
|
||||
if not lib.checkDependency('ox_lib', '1.5.0') then error() end
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value='JS/TS'>
|
||||
|
||||
@@ -25,7 +28,6 @@ import lib from '@overextended/ox_lib/shared'
|
||||
|
||||
if (!lib.checkDependency('ox_lib', '1.5.0')) error()
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
+18
-14
@@ -5,6 +5,7 @@ Faster alternative to PolyZone utilising [glm.polygon](https://github.com/gottfr
|
||||
```lua
|
||||
lib.zones.poly(data)
|
||||
```
|
||||
|
||||
* data: `table`
|
||||
* points: `vector3[]`
|
||||
* All z values must match
|
||||
@@ -20,6 +21,7 @@ lib.zones.poly(data)
|
||||
```lua
|
||||
lib.zones.box(data)
|
||||
```
|
||||
|
||||
* data: `table`
|
||||
* coords: `vector3`
|
||||
* size?: `vector3`
|
||||
@@ -36,6 +38,7 @@ lib.zones.box(data)
|
||||
```lua
|
||||
lib.zones.sphere(data)
|
||||
```
|
||||
|
||||
* data: `table`
|
||||
* coords: `vector3`
|
||||
* radius?: `number`
|
||||
@@ -75,11 +78,11 @@ local poly = lib.zones.poly({
|
||||
vec(420.0, -1030.2, 29),
|
||||
vec(409.8, -1028.4, 29),
|
||||
},
|
||||
thickness = 2,
|
||||
debug = true,
|
||||
inside = inside,
|
||||
onEnter = onEnter,
|
||||
onExit = onExit
|
||||
thickness = 2,
|
||||
debug = true,
|
||||
inside = inside,
|
||||
onEnter = onEnter,
|
||||
onExit = onExit
|
||||
})
|
||||
|
||||
local sphere = lib.zones.sphere({
|
||||
@@ -92,17 +95,18 @@ local sphere = lib.zones.sphere({
|
||||
})
|
||||
|
||||
local box = lib.zones.box({
|
||||
coords = vec3(442.5363, -1017.666, 28.65637),
|
||||
size = vec3(1, 1, 1),
|
||||
rotation = 45,
|
||||
debug = true,
|
||||
inside = insideZone,
|
||||
onEnter = onEnter,
|
||||
onExit = onExit
|
||||
coords = vec3(442.5363, -1017.666, 28.65637),
|
||||
size = vec3(1, 1, 1),
|
||||
rotation = 45,
|
||||
debug = true,
|
||||
inside = insideZone,
|
||||
onEnter = onEnter,
|
||||
onExit = onExit
|
||||
})
|
||||
```
|
||||
|
||||
Zones can be deleted by using the remove method.
|
||||
|
||||
```lua
|
||||
poly:remove()
|
||||
sphere:remove()
|
||||
@@ -110,11 +114,11 @@ box:remove()
|
||||
```
|
||||
|
||||
## Zone creation script
|
||||
|
||||
Similarly to PolyZone, there is a zone creation script included.
|
||||
|
||||
To use it use the `/zone` with `poly`, `box` or `sphere` as args.
|
||||
|
||||
Available controls will be displayed on the right side.
|
||||
|
||||
Once saved you will find the created zone details in created_zones.lua withn ox_lib
|
||||
|
||||
Once saved you will find the created zone details in created_zones.lua within ox_lib
|
||||
+13
-8
@@ -8,7 +8,7 @@ import TabItem from '@theme/TabItem';
|
||||
|
||||
ox_lib is a collection of Lua and UI functions to utilise in other resources.
|
||||
|
||||
The UI is built in React so the code needs to be compiled into standard JS.
|
||||
The UI is built in React so the code needs to be compiled into standard JS.
|
||||
If you don't know how to do this then please download the [release](https://github.com/overextended/ox_lib/releases/latest) (ox_lib.zip) which is *already* compiled into a working resource.
|
||||
|
||||
<Tabs>
|
||||
@@ -28,6 +28,7 @@ Or if the library is the only shared script you use you can do:
|
||||
```lua
|
||||
shared_script '@ox_lib/init.lua'
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value='JS/TS'>
|
||||
|
||||
@@ -39,7 +40,7 @@ All supported functions are located inside the `resource` folder in the lib.
|
||||
|
||||
You can get the npm package [here](https://npmjs.com/package/@overextended/ox_lib).
|
||||
|
||||
**Usage:**
|
||||
**Usage:**
|
||||
You can either import the whole library object which contains all the functions for that scope (client/server/shared) or
|
||||
you can deconstruct it and import the functions you find needed at the time.
|
||||
|
||||
@@ -50,25 +51,27 @@ import lib from '@overextended/ox_lib/server'
|
||||
```ts
|
||||
import { versionCheck } from '@overextended/ox_lib/server'
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
**ACE Permissions:**
|
||||
```
|
||||
|
||||
```yaml
|
||||
add_ace resource.ox_lib command.add_ace allow
|
||||
add_ace resource.ox_lib command.remove_ace allow
|
||||
add_ace resource.ox_lib command.add_principal allow
|
||||
add_ace resource.ox_lib command.remove_principal allow
|
||||
```
|
||||
|
||||
That's it!
|
||||
That's it!
|
||||
You can now use the library functions inside of your resource, check the rest of the
|
||||
documentation to see how to utilise them.
|
||||
|
||||
# Using icons for interface functions
|
||||
## Using icons for interface functions
|
||||
|
||||
The icon library used is Font Awesome 6.0, if for the icon you define only a string
|
||||
the default icon type will be `solid`.
|
||||
the default icon type will be `solid`.
|
||||
If you want to use a different icon type, i.e
|
||||
apple as a brand, you need to define icon as a table (`array`) with the first value being
|
||||
the icon type (`fas`, `far`, `fab`) as a string, and the second being the icon name.
|
||||
@@ -79,23 +82,25 @@ the icon type (`fas`, `far`, `fab`) as a string, and the second being the icon n
|
||||
```lua
|
||||
icon = {'fab', 'apple'}
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value='JS/TS'>
|
||||
|
||||
```ts
|
||||
icon: ['fab', 'apple']
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
# Building the UI
|
||||
## Building the UI
|
||||
|
||||
If you wish to edit any of the UI elements you will need to download the *source* code, edit what you need and then
|
||||
compile it.
|
||||
|
||||
:::danger
|
||||
|
||||
**DO NOT** debundle and unminify the release CSS and JS files to edit them.
|
||||
**DO NOT** de-bundle and un-minify the release CSS and JS files to edit them.
|
||||
:::
|
||||
**Requirements:**
|
||||
|
||||
|
||||
Reference in new issue
Block a user