double space for line break

This commit is contained in:
DokaDoka committed 2022-12-11 16:07:56 +11:00
1 parent 724c7e356d
commit 2b549c3d06
27 files changed
+63 -84

No files matched your search

+2 -3
View File
@@ -4,12 +4,11 @@ title: Home
Here you can find all of the official documentation for resources developed by the Overextended team
If you feel like the documentation is lacking in some department then feel free to go onto that page
and click the "Edit this page" at the bottom and submit a Pull Request.
If you feel like the documentation is lacking in some department then feel free to go onto that page and click the "Edit this page" at the bottom and submit a Pull Request.
## Support our team
Our projects will always remain free and open-source, with our core developers working voluntarily.
Our projects will always remain free and open-source, with our core developers working voluntarily.
If you love what we do and want to help us continue, why not show your appreciation with a donation?
<div style={{paddingLeft:"50px", lineHeight:"20px", background:"url('https://avatars.githubusercontent.com/u/65407488?s=70&v=4') no-repeat left", backgroundSize:"40px"}}>
+1 -1
View File
@@ -4,7 +4,7 @@ We'll try to explain some technical but core concepts used in ox_core here.
## Classes
Lua doesn't have support for true classes, but rather prototype-based inheritance.
Lua doesn't have support for true classes, but rather prototype-based inheritance.
A prototype can hold its own variables and methods, which another object (an instance) can reference or call.
```lua
+3 -3
View File
@@ -10,12 +10,12 @@ import TabItem from '@theme/TabItem';
:::caution
This resource is **not production ready**. Breaking changes are guaranteed, and support is limited.
This resource is **not production ready**. Breaking changes are guaranteed, and support is limited.
Documentation may fall behind and be rendered obsolete.
:::
We **strongly** recommend using Git to help with version control and separating your own changes from the original source code.
We **strongly** recommend using Git to help with version control and separating your own changes from the original source code.
Refer to [GitHub's guide to setting up Git](https://docs.github.com/en/get-started/quickstart/set-up-git#setting-up-git).
You can also download a Git GUI client, such as [GitKraken](https://www.gitkraken.com/), to improve your workflow and more easily maintain changes.
@@ -72,7 +72,7 @@ Phone with many built-in apps such as Twitter, Marketplace, and Notes; with supp
### pefcl
Banking and financing, with support for multiple, unique, and shared accounts.
Banking and financing, with support for multiple, unique, and shared accounts.
If using it with [ox_inventory](https://github.com/overextended/ox_inventory), open `pefcl/config.json` and enable framework integration.
```json
+2 -2
View File
@@ -21,7 +21,7 @@ player.set(key, value, replicated)
## player.setdb
Update the player's metadata and store in the DB, optionally syncing it with the client.
Update the player's metadata and store in the DB, optionally syncing it with the client.
Note: These values are not synced to the client on login; you will need to use `player.set`.
```lua
@@ -87,7 +87,7 @@ player.getGroups()
## player.hasGroup
Check if the player is a member of a given group, and returns the matching group name and grade.
Check if the player is a member of a given group, and returns the matching group name and grade.
The filter can be a string, array, or object where key is the group, and value is the minimum grade.
```lua
+2 -2
View File
@@ -27,7 +27,7 @@ end
## Ox.CreateVehicle
Spawns a vehicle and returns the instance of CVehicle.
Spawns a vehicle and returns the instance of CVehicle.
If the first argument is a number, it will attempt to spawn a vehicle from the database with a matching id.
```lua
@@ -43,7 +43,7 @@ if vehicleId then
end
```
If the first argument is a table and the owner property is a number, or nil, the vehicle will be added to the database.
If the first argument is a table and the owner property is a number, or nil, the vehicle will be added to the database.
Setting the owner as false creates a non-persistent vehicle.
```lua
+1 -1
View File
@@ -86,7 +86,7 @@ vehicle.setGroup(group)
## vehicle.setPlate
Sets the vehicle's plate, used in the database to ensure uniqueness. Does not necessarily match the plate property (i.e. fake plates).
Sets the vehicle's plate, used in the database to ensure uniqueness. Does not necessarily match the plate property (i.e. fake plates).
Plate is always formatted to 8 characters.
```lua
@@ -1,4 +1,4 @@
Uses the passed item, then triggers the callback function.
Uses the passed item, then triggers the callback function.
Should be calling during item callbacks to utilise the builtin methods (server checks, progress bar, etc.).
```lua
+4 -4
View File
@@ -19,8 +19,8 @@ otherwise you **should not** install this resource.
### oxmysql
We utilise our own resource to communicate with MySQL databases via the node-mysql2 package.
The backend is actively maintained and updated unlike the package used by mysql-async, providing improved performance, security, and features.
We utilise our own resource to communicate with MySQL databases via the node-mysql2 package.
The backend is actively maintained and updated unlike the package used by mysql-async, providing improved performance, security, and features.
We provide full backwards compatibility with mysql-async and build for the current Cfx architecture.
<ResourceLinks repo="https://www.github.com/overextended/oxmysql" docs="../oxmysql"></ResourceLinks>
@@ -43,7 +43,7 @@ The resources listed under here **aren't** necessary for the inventory to work b
### ox_target
A performant and flexible standalone "third-eye" targeting resource.
A performant and flexible standalone "third-eye" targeting resource.
Stashes, shops, and crafting benches will be accessible via zone targets instead of using markers.
<ResourceLinks repo="https://www.github.com/overextended/ox_target" docs="../ox_target"></ResourceLinks>
@@ -60,7 +60,7 @@ The inventory will handle disabling the phone when the player has no item, and s
### Production Build
The user interface included with the source code must be compiled.
The user interface included with the source code must be compiled.
You can compile it yourself by following the [build guide](./Guides/inventory_ui), otherwise download a production build below.
<ResourceLinks repo="https://github.com/overextended/ox_inventory/releases/latest"></ResourceLinks>
+4 -4
View File
@@ -8,16 +8,16 @@ sidebar_position: 1
Because the UI for inventory is written in React it can't run natively under FiveM so it must first be bundled into html/css/js.
We provide an easy way for you to do this by downloading a pre-bundled release, which you can get from [here](https://github.com/overextended/ox_inventory/releases/latest).
We provide an easy way for you to do this by downloading a pre-bundled release, which you can get from [here](https://github.com/overextended/ox_inventory/releases/latest).
Make sure you download the `ox_inventory.zip` file as that one contains the bundled files and others are raw source code.
If in case you wanted to edit the inventory UI you would have to build these files yourself.
If in case you wanted to edit the inventory UI you would have to build these files yourself.
To do so please read our [_Building inventory UI_](../Guides/inventory_ui.md) guide.
## Stashes / trunks are not saved at server restart
The only supported way of doing a restart is **txAdmin scheduled restart**.
The only supported way of doing a restart is **txAdmin scheduled restart**.
txAdmin scheduled restart should be your only way of restarting a server in production.
If you need to do a manual restart, you must use `/saveinv` before restarting the server.
If you need to do a manual restart, you must use `/saveinv` before restarting the server.
If you don't do this, all inventory except players inventory will not be saved.
+1 -1
View File
@@ -2,5 +2,5 @@
title: Guides
---
Providing examples and explaining certain inventory API into more detail.
Providing examples and explaining certain inventory API into more detail.
If you have trouble understanding how some of the API works check out our [**_example resource_**](https://github.com/overextended/ox_inventory_examples).
+1 -1
View File
@@ -1,4 +1,4 @@
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';
+1 -1
View File
@@ -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
+1 -1
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
+7 -14
View File
@@ -77,10 +77,8 @@ 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.
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.
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
@@ -283,8 +281,7 @@ RegisterCommand('testcontext', () => {
</TabItem>
</Tabs>
To trigger the event from the `Event button` and get it's data we first
need to register the event properly:
To trigger the event from the `Event button` and get it's data we first need to register the event properly:
<Tabs>
<TabItem value='Lua'>
@@ -337,19 +334,15 @@ onNet('some_event', () => {
</TabItem>
</Tabs>
The data from the `args` table in the menu is passed as a first argument to
the event you register, in this case that argument is called `data`.
The data from the `args` table in the menu is passed as a first argument to 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
neat back arrow button next to the menu title that will take us back.
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
the button will do nothing upon being clicked.
If we have a button that does not define either event, serverEvent or menu 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.
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)
+4 -10
View File
@@ -58,21 +58,15 @@ lib.inputDialog(heading, rows)
* step?: `number`
* Amount of change per slider step. Used only with `'slider'` type.
The callback data is promise based meaning that the thread will
not continue executing until the user either sends the data
or exits the popup.
The callback data is promise based meaning that the thread will not continue executing until the user either sends the data or exits the popup.
The data returned will be a table (array), indexes represent the rows
sent to the dialog, so if we want data from the first field that
would be index `1` (`0`), if we want data from the third field, that would
be index `3` (`2`), etc...
The data returned will be a table (array), indexes represent the rows sent to the dialog, so if we want data from the first field that would be index `1` (`0`), if we want data from the third field, that would be index `3` (`2`), etc...
The standard input rows will always return a string, if you want a row to be of
number data type, you can use set the `type` to `number`.
The standard input rows will always return a string, if you want a row to be of 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
+1 -1
View File
@@ -1,4 +1,4 @@
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
+3 -3
View File
@@ -1,6 +1,6 @@
## 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
@@ -22,8 +22,8 @@ lib.logger(source, event, message, ...)
- 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
+1 -1
View File
@@ -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';
+1 -1
View File
@@ -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';
+8 -14
View File
@@ -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>
@@ -40,9 +40,8 @@ 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:**
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.
**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.
```ts
import lib from '@overextended/ox_lib/server'
@@ -64,17 +63,13 @@ add_ace resource.ox_lib command.add_principal allow
add_ace resource.ox_lib command.remove_principal allow
```
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.
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
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`.
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.
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`.
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.
<Tabs>
<TabItem value='Lua'>
@@ -95,8 +90,7 @@ icon: ['fab', 'apple']
## 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.
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
+2 -2
View File
@@ -42,7 +42,7 @@ exports.ox_target:removeModel(models, optionNames)
## addEntity
Add new options when targeting a networked entity matching the given netid or list of netIds.
Add new options when targeting a networked entity matching the given netid or list of netIds.
Requires the use of [NetworkGetNetworkIdFromEntity](https://docs.fivem.net/natives/?_0x9E35DAB6) on an entity id.
```lua
@@ -51,7 +51,7 @@ exports.ox_target:addEntity(netIds, options)
## removeEntity
Remove options from a networked entity matching the given netid or list of netIds.
Remove options from a networked entity matching the given netid or list of netIds.
Requires the use of [NetworkGetNetworkIdFromEntity](https://docs.fivem.net/natives/?_0x9E35DAB6) on an entity id.
```lua
+6 -7
View File
@@ -26,8 +26,8 @@ XAMPP is not a database, and should not be used solely to start your MySQL/Maria
## Configuration
You can change the configuration settings by using convars inside your `server.cfg`.
Reference the following for an idea of how to set your connection options.
You can change the configuration settings by using convars inside your `server.cfg`.
Reference the following for an idea of how to set your connection options.
You must include one of the following lines, adjusted for your connection and database settings.
:::caution
@@ -40,7 +40,7 @@ set mysql_connection_string "mysql://root:12345@localhost:3306/es_extended?chars
set mysql_connection_string "user=root;password=12345;host=localhost;port=3306;database=es_extended;charset=utf8mb4"
```
Certain special characters are reserved or blocked and may cause issues when used in your password.
Certain special characters are reserved or blocked and may cause issues when used in your password.
For more optional settings (such as multiple statements) you can reference [pool.d.ts](https://github.com/sidorares/node-mysql2/blob/master/typings/mysql/lib/Pool.d.ts#L10) and [connection.d.ts](https://github.com/sidorares/node-mysql2/blob/master/typings/mysql/lib/Connection.d.ts#L8).
You can also add the following convars if you require extra information when testing queries.
@@ -76,17 +76,16 @@ Before using the UI first you have to make sure you have the `mysql_ui` convar s
set mysql_ui true
```
Also make sure that you have `command` ace permission access, then you should be able to use the
`mysql` command in game to open up the UI and see your query data.
Also make sure that you have `command` ace permission access, then you should be able to use the `mysql` command in game to open up the UI and see your query data.
## Compatibility
You shouldn't run multiple mysql resources to ensure the best experience.
You shouldn't run multiple mysql resources to ensure the best experience.
The resources listed below can be deleted to allow oxmysql to handle the events, without any changes.
### mysql-async
Standard API for mysql-async uses `server_script '@mysql-async/lib/MySQL.lua'`.
Standard API for mysql-async uses `server_script '@mysql-async/lib/MySQL.lua'`.
Raw exports, mostly used in resources written in JavaScript or C#, are _not supported_.
### ghmattimysql
+1 -1
View File
@@ -4,7 +4,7 @@
This is usually the result of incorrect database settings or your password containing reserved characters (`; , / ? : @ & = + $ #`).
:::tip Solution
Ensure you have entered the correct database settings in the mysql_connection_string convar.
Ensure you have entered the correct database settings in the mysql_connection_string convar.
You can try using the semicolon-separated format if your password contains reserved characters.
:::
+2 -2
View File
@@ -43,7 +43,7 @@ import { oxmysql as MySQL } from '@overextended/oxmysql';
## Placeholders
Safely format queries by using placeholders in the query, and sending arguments in an array or object.
Safely format queries by using placeholders in the query, and sending arguments in an array or object.
Named placeholders are not recommended, and unsupported when using MySQL.prepare.
```lua
@@ -59,5 +59,5 @@ When uncertain if a row should be inserted into the database, or an existing row
MySQL.prepare('INSERT INTO ox_inventory (owner, name, data) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE data = VALUES(data)', { owner, dbId, inventory })
```
This is preferred over checking the existence of a row, then inserting or updating depending on the result.
This is preferred over checking the existence of a row, then inserting or updating depending on the result.
Furthermore, unlike using 'REPLACE INTO', the row is not deleted and re-inserted.
+1 -1
View File
@@ -1,6 +1,6 @@
# Prepare
The only function that provides true [prepared statements](https://github.com/sidorares/node-mysql2#using-prepared-statements), granting native protection and query planning by MySQL.
The only function that provides true [prepared statements](https://github.com/sidorares/node-mysql2#using-prepared-statements), granting native protection and query planning by MySQL.
Prepare can be used to execute frequently called queries faster and accepts multiple sets of parameters to be used with a single query.
- Date will not return the datestring commonly used in FiveM
+1 -1
View File
@@ -1,6 +1,6 @@
# Query
Generic function that can be utilised for any query.
Generic function that can be utilised for any query.
When selecting data it will return all matching rows and columns, otherwise it will return field data such as insertid, affectedRows, etc.
## Lua
+1 -1
View File
@@ -67,7 +67,7 @@ console.log(success);
## Shared Format
When using the `Shared` format you must pass two parameters to the oxmysql export. The `queries` and the `parameters` those queries will use.
When using the `Shared` format you must pass two parameters to the oxmysql export. The `queries` and the `parameters` those queries will use.
This is useful if your queries use the same SQL variables.
### Lua