This commit is contained in:
Luke committed 2023-06-04 15:15:21 +02:00
1 parent 3cebaf7fa5
commit b5eba8423f
229 files changed
+6238 -10690

No files matched your search

-12
View File
@@ -1,12 +0,0 @@
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
trim_trailing_whitespace = false
indent_size = 2
indent_style = space
+35
View File
@@ -0,0 +1,35 @@
name: Deploy to GitHub Pages
on:
push:
branches:
- main
jobs:
deploy:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@v2
with:
version: 8.6.0
- uses: actions/setup-node@v2
with:
node-version: 16.x
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build website
run: pnpm build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./out
user_name: github-actions[bot]
user_email: 41898282+github-actions[bot]@users.noreply.github.com
-45
View File
@@ -1,45 +0,0 @@
name: Deploy to GitHub Pages
on:
push:
branches:
- main
# Review gh actions docs if you want to further define triggers, paths, etc
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
jobs:
deploy:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@v2
with:
version: 8.1.1
- uses: actions/setup-node@v2
with:
node-version: 16.x
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build website
run: pnpm build
# Popular action to deploy to GitHub Pages:
# Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Build output to publish to the `gh-pages` branch:
publish_dir: ./build
# The following lines assign commit authorship to the official
# GH-Actions bot for deploys to `gh-pages` branch:
# https://github.com/actions/checkout/issues/13#issuecomment-724415212
# The GH actions bot is used by default if you didn't specify the two fields.
# You can swap them out with your own user credentials.
user_name: github-actions[bot]
user_email: 41898282+github-actions[bot]@users.noreply.github.com
+3 -20
View File
@@ -1,20 +1,3 @@
# Dependencies
/node_modules
# Production
/build
# Generated files
.docusaurus
.cache-loader
# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.next
node_modules
out
-1
View File
@@ -1 +0,0 @@
auto-install-peers=true
+9 -8
View File
@@ -1,9 +1,10 @@
{
"printWidth": 120,
"singleQuote": true,
"useTabs": false,
"tabWidth": 2,
"semi": true,
"bracketSpacing": true,
"trailingComma": "es5"
}
"printWidth": 120,
"singleQuote": true,
"useTabs": false,
"tabWidth": 2,
"semi": true,
"bracketSpacing": true,
"trailingComma": "es5",
"plugins": ["prettier-plugin-tailwindcss"]
}
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Shu Ding
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+12 -30
View File
@@ -1,41 +1,23 @@
# Website
# Nextra Docs Template
This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.
This is a template for creating documentation with [Nextra](https://nextra.site).
### Installation
[**Live Demo →**](https://nextra-docs-template.vercel.app)
```
$ yarn
```
[![](.github/screenshot.png)](https://nextra-docs-template.vercel.app)
### Local Development
## Quick Start
```
$ yarn start
```
Click the button to clone this repository and deploy it on Vercel:
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
[![](https://vercel.com/button)](https://vercel.com/new/clone?s=https%3A%2F%2Fgithub.com%2Fshuding%2Fnextra-docs-template&showOptionalTeamCreation=false)
### Build
## Local Development
```
$ yarn build
```
First, run `pnpm i` to install the dependencies.
This command generates static content into the `build` directory and can be served using any static contents hosting service.
Then, run `pnpm dev` to start the development server and visit localhost:3000.
### Deployment
## License
Using SSH:
```
$ USE_SSH=true yarn deploy
```
Not using SSH:
```
$ GIT_USER=<Your GitHub username> yarn deploy
```
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
This project is licensed under the MIT License.
-3
View File
@@ -1,3 +0,0 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
+18
View File
@@ -0,0 +1,18 @@
import { IconCoffee } from '@tabler/icons-react';
const DonateLink: React.FC<{ image: string; name: string; kofiName: string }> = ({ image, name, kofiName }) => {
return (
<div className="flex w-32 flex-col items-center justify-center gap-2">
<p>{name}</p>
<img src={image} alt={`${name}-image`} className="rounded-md bg-neutral-100 shadow-md dark:bg-neutral-900" />
<a href={`https://ko-fi.com/${kofiName}`} target="_blank" className="w-full">
<button className="flex w-full items-center justify-center gap-2 rounded-md bg-sky-500/20 p-2 text-sky-500 hover:bg-sky-500/30">
<IconCoffee />
Support
</button>
</a>
</div>
);
};
export default DonateLink;
+9
View File
@@ -0,0 +1,9 @@
import { DocSearch } from '@docsearch/react';
import '@docsearch/css';
const Search: React.FC = () => {
return <DocSearch appId="8XXXVNJ7UW" apiKey="3680aeb79049744c6629dd0abd2f5dfe" indexName="overextended" />;
};
export default Search;
+65
View File
@@ -0,0 +1,65 @@
import React from 'react';
import { IconBrandGithub, IconTag, IconFileText, IconDownload, IconBrandNpm } from '@tabler/icons-react';
interface Props {
icon?: React.ReactNode;
children?: React.ReactNode;
side?: 'left' | 'right';
link?: string;
}
const Button: React.FC = ({ side = 'left', children, icon, link }: Props) => {
return (
<div className="h-fit w-fit">
<a href={link}>
<div className="flex w-26 items-center justify-center gap-1.5 rounded-sm border border-black p-1.5 text-black hover:bg-black hover:text-white dark:border-white dark:text-white dark:hover:bg-white dark:hover:text-black mt-2">
{side === 'left' && <div>{icon}</div>}
{children}
{side === 'right' && <div>{icon}</div>}
</div>
</a>
</div>
);
};
export default Button;
export function GhButton(props: Props) {
return (
<Button icon={<IconBrandGithub />} side={props.side} link={props.link}>
GitHub
</Button>
);
}
export function DocButton(props: Props) {
return (
<Button icon={<IconFileText />} side={props.side} link={props.link}>
Documentation
</Button>
);
}
export function DownloadButton(props: Props) {
return (
<Button icon={<IconDownload />} side={props.side} link={props.link}>
Download
</Button>
);
}
export function ReleaseButton(props: Props) {
return (
<Button icon={<IconTag />} side={props.side} link={props.link}>
Releases
</Button>
);
}
export function NpmButton(props: Props) {
return (
<Button icon={<IconBrandNpm />} side={props.side} link={props.link}>
Package
</Button>
);
}
+20
View File
@@ -0,0 +1,20 @@
import React from 'react';
import { GhButton, DocButton, ReleaseButton } from './button';
interface Props {
children?: React.ReactNode;
repo: string;
docs?: string;
}
const ResourceLinks = ({ repo, docs }: Props) => {
return (
<div className="flex flex-wrap gap-1">
<GhButton link={repo} />
<ReleaseButton link={`${repo}/releases`} />
{docs && <DocButton link={docs} />}
</div>
);
};
export default ResourceLinks;
-6
View File
@@ -1,6 +0,0 @@
label: Guides
collapsible: true
collapsed: true
link:
type: generated-index
position: 1.5
-34
View File
@@ -1,34 +0,0 @@
---
title: Home
sidebar_position: 1
---
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.
## Support our team
Providing and maintaining free open-source resources to the community takes a lot of time and hard work.
If you appreciate what we do, consider supporting us so we can continue our work.
<div style={{paddingLeft:"50px", lineHeight:"20px", background:"url('https://avatars.githubusercontent.com/u/65407488?s=70&v=4') no-repeat left", backgroundSize:"40px"}}>
Linden
https://ko-fi.com/thelindat
</div>
<div style={{paddingLeft:"50px", lineHeight:"20px", background:"url('https://avatars.githubusercontent.com/u/39926192?s=120&v=4') no-repeat left", backgroundSize:"40px"}}>
Luke
https://ko-fi.com/lukewastaken
</div>
<div style={{paddingLeft:"50px", lineHeight:"20px", background:"url('https://avatars.githubusercontent.com/u/31368547?s=120&v=4') no-repeat left", backgroundSize:"40px"}}>
DokaDoka
https://ko-fi.com/dokadoka
</div>
-20
View File
@@ -1,20 +0,0 @@
# Config
Resource configuration is handled using [convars](https://docs.fivem.net/docs/scripting-reference/convars/).
```yaml
# Players must have a valid identifier to join the server. Used to fetch userid from the database.
set ox:primaryIdentifier "fivem"
# Set the number of active characters a user can have registered.
setr ox:characterSlots 5
# Enables debug and development features. Should only be used in a development environment.
setr ox:debug 0
# Disable death system handle by core.
setr ox:deathSystem 0
# Disable the spawn selection.
setr ox:spawnSelect 0
```
-48
View File
@@ -1,48 +0,0 @@
# Importing the core functions
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import IconButton from '@site/src/components/IconButton';
import { FaNpm } from 'react-icons/fa';
## Lua
Lua imports can be defined as part of fxmanifest, or loaded with the load function.
<Tabs>
<TabItem value="1" label="fxmanifest">
```lua
client_scripts {
'@ox_core/imports/client.lua',
'client/main.lua',
}
server_scripts {
'@oxmysql/lib/MySQL.lua',
'@ox_core/imports/server.lua',
'server/main.lua',
}
```
</TabItem>
<TabItem value="2" label="load">
```lua
local file = ('imports/%s.lua'):format(IsDuplicityVersion() and 'server' or 'client')
local import = LoadResourceFile('ox_core', file)
local chunk = assert(load(import, ('@@ox_core/%s'):format(file)))
chunk()
```
</TabItem>
</Tabs>
## JS/TS
If in case you want to write resources in JS/TS you will need to install our node client and server wrapper package,
which will allow you to use the core's functions with full type and intellisense support.
<a href='https://www.npmjs.com/package/@overextended/ox_core'>
<IconButton style={{marginTop: '0.7rem'}} side='left' icon={<FaNpm/>}>Package</IconButton>
</a>
-86
View File
@@ -1,86 +0,0 @@
---
title: Getting started
sidebar_position: 1
slug: ./../
---
import ResourceLinks from '@site/src/components/ResourceLinks';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
:::caution
This resource does not have a stable (v1.0) release; breaking changes are likely.
Documentation may not be kept updated in some cases.
:::
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.
## Dependencies
These resources are required for ox_core to function, and must start before it.
- [oxmysql](https://github.com/overextended/oxmysql/)
- [ox_lib](https://github.com/overextended/ox_lib/)
- [fivem-appearance](https://github.com/pedr0fontoura/fivem-appearance)
- [ox_appearance](https://github.com/overextended/ox_appearance)
## Installation
<Tabs>
<TabItem value="1" label="Recommended">
- [Download](https://www.nodejs.org/) and install the LTS version of Node.js 16.
- Open a terminal, command prompt, etc. and navigate to your resources folder.
- Execute the following commands
```bash
npm install --location=global pnpm
git clone https://github.com/overextended/ox_core.git
cd web
pnpm i
pnpm build
```
</TabItem>
<TabItem value="2" label="Lazy">
- Download a tagged [release](https://github.com/overextended/ox_core/releases).
</TabItem>
</Tabs>
## Recommended resources
The following resources aren't required, but should offer the best experience for your server.
### ox_inventory
Slot-based inventory system with support for item metadata (uniqueness), shops, crafting, and much more.
<ResourceLinks repo="https://github.com/overextended/ox_inventory" docs="../ox_inventory"></ResourceLinks>
### npwd
Phone with many built-in apps such as Twitter, Marketplace, and Notes; with support for 3rd party app integration.
<ResourceLinks repo="https://github.com/project-error/npwd" docs="https://projecterror.dev/docs/npwd/start/installation"></ResourceLinks>
### pefcl
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
"frameworkIntegration": {
"enabled": true,
"resource": "ox_inventory",
"syncInitialBankBalance": false
},
```
<ResourceLinks repo="https://github.com/project-error/pefcl" docs="https://projecterror.dev/docs/pefcl/installation"></ResourceLinks>
-23
View File
@@ -1,23 +0,0 @@
---
title: Client
sidebar_position: 1
---
### player
The player variable refers to the result of [Ox.GetPlayerData](https://github.com/overextended/ox_core/blob/main/client/player.lua#L48) unless reassigned.
**Example:**
```lua
print(json.encode(player, { indent = true }))
```
- player?: `table`
- name: `string`
- firstname: `string`
- lastname: `string`
- userid: `number`
- charid: `number`
- groups: `table`
- gender: `string`
-14
View File
@@ -1,14 +0,0 @@
# Server
## ox_doorlock:stateChanged
Triggered when a doors state is updated.
```lua
AddEventHandler('ox_doorlock:stateChanged', function(source, doorId, state, usedItem) end)
```
- source: `number` or `nil`
- doorId: `number`
- state: `0` or `1`
- usedItem: `string` or `false`
@@ -1,5 +0,0 @@
Attempt to pick the lock of the closest door. Dependant on server-side checks and may fail.
```lua
exports.ox_doorlock:pickClosestDoor()
```
@@ -1,5 +0,0 @@
Interact with the closest door. Dependant on server-side checks and may fail.
```lua
exports.ox_doorlock:useClosestDoor()
```
@@ -1,7 +0,0 @@
Gets data for a door with the given id, matching the id for the database entry.
```lua
exports.ox_doorlock:getDoor(id)
```
- id: `number`
@@ -1,7 +0,0 @@
Gets data for a door with the given name, matching the name for the database entry.
```lua
exports.ox_doorlock:getDoorFromName(name)
```
- name: `string`
-6
View File
@@ -1,6 +0,0 @@
label: Ox Doorlock
collapsible: true
collapsed: true
link:
type: generated-index
description: A door management resource that can be used standalone or alongside ox_core, qb-core, and es_extended.
-6
View File
@@ -1,6 +0,0 @@
# Door Conversion
Door configuration files written for nui_doorlock (and its fork, qb-doorlock) can be automatically added to your MySQL database.
- Any files with the `.lua` extension placed in the `ox_doorlock/convert` directory will be read on resource start.
- Conversion cannot be guaranteed, especially if the config was not written for nui_doorlock.
-51
View File
@@ -1,51 +0,0 @@
---
title: Getting started
sidebar_position: 1
---
## Installation
We always recommend using Git so you can track changes and update easily, however this requires building the UI.
Otherwise, download the [latest release](https://github.com/overextended/ox_doorlock/releases).
### Building
You can ignore this if you downloaded a release build.
- [Download](https://www.nodejs.org/) and install the LTS version of Node.js.
- Open a terminal, command prompt, etc. and navigate to your resources folder.
- Execute the following commands
```bash
npm install --location=global pnpm
git clone https://github.com/overextended/ox_doorlock.git
cd web
pnpm i
pnpm build
```
### Dependencies
- [oxmysql](https://github.com/overextended/oxmysql/)
- [ox_lib](https://github.com/overextended/ox_lib/)
### Optional Dependencies
- [ox_target](https://github.com/overextended/ox_target/) or [qtarget](https://github.com/overextended/qtarget) or [qb-target](https://github.com/qbcore-framework/qb-target)
- Doors can be lockpicked using the interaction menu.
### Supported Frameworks
These aren't necessary to run ox_doorlock, but they will add additional features.
- [ox_core](https://github.com/overextended/ox_core)
- [esx](https://github.com/esx-framework/esx-legacy)
- [qb-core](https://github.com/qbcore-framework/qb-core)
## Opening the UI
Assuming you've installed the resource and it has started, you can use `/doorlock` to open the UI.
- If the cursor is displayed but nothing appeared, the UI hasn't been built.
- Check you are authorised to use the command.
- Type `test_ace player.1 command.doorlock` in the server console (replace 1 with your server id).
-6
View File
@@ -1,6 +0,0 @@
label: Ox Fuel
collapsible: true
collapsed: true
link:
type: generated-index
description: A simple fuel resource meant to replace LegacyFuel or serve as a showcase for using petrol cans as an item.
@@ -1,30 +0,0 @@
Creates a new custom stash.
```lua
exports.ox_inventory:RegisterStash(id, label, slots, maxWeight, owner, groups, coords)
```
* id: `string` or `number`
* Stash identifier when loading from the database.
* label: `string`
* Display name when inventory is open.
* slots: `number`
* maxWeight: `number`
* owner: `string` or `boolean` or `nil`
* `string`: Can only access the stash linked to the owner.
* `true`: Each player has a unique stash but can request other player's stashes.
* `nil`: Always shared.
* groups: `table`
* Table of player groups (jobs) able to access the stash.
* Table of group names where the numeric value is the minimum grade required.
* `{['police'] = 0, ['ambulance'] = 2}`
* coords?: `vector3` or `vector3[]`
:::caution
This function needs to be triggered before a player can open the stash.
:::
**Example:**
For a use case example on this function check out the written [Guide](../../../Guides/stashes.md) for it.
-123
View File
@@ -1,123 +0,0 @@
---
sidebar_position: 2
---
# Configuration
You can add these settings directly to your 'server.cfg', or add them to a separate file (i.e. inventory.cfg) and call it with `exec`.
:::caution
Convars **must** be set before starting ox_inventory.
:::
The values below are _defaults_ and should not be explicitly set unless changing the value.
```yaml
### Shared
# Activate specific event handlers and functions (supported: ox, esx, qb, nd)
setr inventory:framework "esx"
# Number of slots for player inventories
setr inventory:slots 50
# Maximum carry capacity for players, in grams (frameworks may override this)
setr inventory:weight 30000
# Integrated support for qtarget/ox_target stashes, shops, etc
# Note: qtarget is deprecated, a future update may drop support (ox_target only, or gated features)
setr inventory:target false
# Jobs with access to police armoury, evidence lockers, etc
setr inventory:police ["police", "sheriff"]
### Client
# The URL to load item images from
setr inventory:imagepath "nui://ox_inventory/web/images"
# Weapons will reload after reaching 0 ammo
setr inventory:autoreload false
# Blur the screen while accessing the inventory
setr inventory:screenblur true
# Default hotkeys to access primary and secondary inventories, and hotbar
setr inventory:keys ["F2", "K", "TAB"]
# Enable control action when inventory is open
setr inventory:enablekeys [249]
# Weapons must be aimed before shooting
setr inventory:aimedfiring false
# Show a list of all nearby players when giving items
setr inventory:giveplayerlist false
# Toggle weapon draw/holster animations
setr inventory:weaponanims true
# Toggle item notifications (add/remove)
setr inventory:itemnotify true
# Disable drop markers and spawn a prop instead
setr inventory:dropprops true
# Set the default model used for drop props
setr inventory:dropmodel "prop_med_bag_01b"
# Disarm the player if an unexpected weapon is in use (i.e. did not use the weapon item)
setr inventory:weaponmismatch true
# Ignore weapon mismatch checks for the given weapon type (e.g. ['WEAPON_SHOVEL', 'WEAPON_HANDCUFFS'])
setr inventory:ignoreweapons []
# Suppress weapon and ammo pickups
setr inventory:suppresspickups 1
### Server
# Compare current version to latest release on GitHub
set inventory:versioncheck true
# Stashes will be wiped after remaining unchanged for the given time
set inventory:clearstashes "6 MONTH"
# Discord webhook url, used for imageurl metadata content moderation (image embeds)
set inventory:webhook ""
# Logging via ox_lib (0: Disable, 1: Standard, 2: Include AddItem/RemoveItem, and all shop purchases)
set inventory:loglevel 1
# Item prices fluctuate in shops
set inventory:randomprices true
# Loot will randomly generate inside unowned vehicles and dumpsters
set inventory:randomloot true
# Minimum job grade to remove items from evidence lockers
set inventory:evidencegrade 2
# Trim whitespace from vehicle plates when checking owned vehicles
setr inventory:trimplate true
# Set the contents of randomly generated inventories
# [item name, minimum, maximum, loot chance]
set inventory:vehicleloot [
["cola", 1, 1],
["water", 1, 1],
["garbage", 1, 2, 50],
["panties", 1, 1, 5],
["money", 1, 50],
["money", 200, 400, 5],
["bandage", 1, 1]
]
set inventory:dumpsterloot [
["mustard", 1, 1],
["garbage", 1, 3],
["money", 1, 10],
["burger", 1, 1]
]
```
@@ -1,98 +0,0 @@
---
title: Getting started
sidebar_position: 1
slug: ./../
---
import ResourceLinks from '@site/src/components/ResourceLinks';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
:::caution
This resource is being designed with the intention of providing advanced functionality while remaining easy to use,
however it is not recommended for beginners. You must possess a basic understanding of coding and the ability to read;
otherwise you **should not** install this resource.
:::
## Dependencies
### 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 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>
### ox_lib
Provides easily reusable functions that can be imported into your resource or called with exports. Notably used for
- Intervals
- Event callbacks
- Streaming
- Points and markers
- Notifications and progress bar
<ResourceLinks repo="https://www.github.com/overextended/ox_lib" docs="../ox_lib"></ResourceLinks>
## Optional Dependencies
The resources listed under here **aren't** necessary for the inventory to work but still have full support.
### ox_target
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>
### npwd
A standalone and feature-rich phone created by Project Error.
The inventory will handle disabling the phone when the player has no item, and supports toggling the phone through item use.
<ResourceLinks repo="https://github.com/project-error/npwd" docs="https://projecterror.dev/docs/npwd/start/installation"></ResourceLinks>
## Installation
### Production Build
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>
### Setup
If you are using a supported framework, refer to the dedicated guide in the navigation bar.
#### Custom Framework
Integration between your framework and ox_inventory should be relatively simple if you aren't replacing and attempting to support backwards-compatibility with an existing inventory system.
You should first reference the [mysql](https://github.com/overextended/ox_inventory/blob/main/modules/mysql/server.lua) module and setup appropriate table and column names.
```lua
elseif shared.framework == 'myframework' then
playerTable = 'characters' -- table storing player / character data
playerColumn = 'charid' -- primary key for identifying the character (i.e. identifier, citizenid, id)
vehicleTable = 'vehicles' -- table storing owned vehicle data
vehicleColumn = 'id' -- primary key for identifying the vehicle (i.e. plate, vin, id)
end
```
You will need events and functions to handle licenses, owned vehicles, and job systems; these should be handled in the "bridge" module.
If your framework doesn't have its own inventory system or you don't care about compatibility, it may be easier to refer to the incredibly barebones [ox bridge](https://github.com/overextended/ox_inventory/tree/main/modules/bridge/ox) (used by ox_core).
Refer to the [esx bridge](https://github.com/overextended/ox_inventory/tree/main/modules/bridge/esx) or [qbcore bridge](https://github.com/overextended/ox_inventory/tree/main/modules/bridge/qb) to get an idea of replacing existing inventories.
... todo: more information, work on a bridge template
:::caution
You should restart your server after the first startup to ensure everything has been correctly setup
:::
-6
View File
@@ -1,6 +0,0 @@
---
title: Guides
---
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).
-41
View File
@@ -1,41 +0,0 @@
---
title: Building inventory UI
---
import IconButton from '@site/src/components/IconButton'
import {FaNodeJs} from 'react-icons/fa'
## Requirements to build:
* Node.js
* pnpm
## Installing Node.js:
* Download the LTS version of Node.js.
* Go through the install and make sure you install all of the features.
* Run `node --version` in cmd and make sure that it gives you the version number. If it doesn't then you didn't install it correctly.
<div style={{width: 'fit-content'}}>
<a href="https://www.nodejs.org">
<IconButton side='left' icon={<FaNodeJs/>}>Download</IconButton>
</a>
</div>
## Installing pnpm:
* Now that you've installed Node.js you can install pnpm by running `npm install -g pnpm` in cmd.
## Building the UI:
* cd into the web directory of ox_inventory
* In your cmd type `pnpm i` and it will start downloading the node modules.
* After it's done downloading node modules you can run `pnpm build` to build the UI.
:::info Hot reloads
When working in the browser you can run `pnpm start`, which supports hot reloads meaning that
you will see your changes after saving your file.
If you want to work in game you can run `pnpm watch` which writes changes to disk, so
the only thing you have to do is restart the resource for it take affect.
:::
@@ -1,126 +0,0 @@
---
title: Alert Dialog
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
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
<Tabs>
<TabItem value='Lua'>
<Tabs>
<TabItem value='Client'>
```lua
lib.alertDialog(data)
```
</TabItem>
<TabItem value='Server'>
```lua
TriggerClientEvent('ox_lib:alertDialog', source, data)
```
</TabItem>
</Tabs>
</TabItem>
<TabItem value='JS/TS'>
:::caution
This function is **asynchronous** requiring you to do a `.then` callback on the promise or make your function `async`.
:::
```ts
import lib from '@overextended/ox_lib/client'
lib.alertDialog(data)
```
</TabItem>
</Tabs>
* data: `table` (`object`)
* header: `string`
* Dialog title.
* content: `string`
* Dialog body content, supports markdown.
* centered?: `boolean`
* Centers the dialog vertically and horizontally.
* cancel?: `boolean`
* Displays a cancel button (ESC is still available if this is not defined).
* size?: `'xs'` or `'sm'` or `'md'` or `'lg'` or `'xl'`
* overflow?: `boolean`
* labels?: `table`
* Allows you to define the displayed labels for cancel and/or confirm buttons.
* cancel?: `string`
* confirm?: `string`
Returns `confirm` if the player pressed the confirm button, otherwise if the player pressed the cancel button
or has exited the dialog with ESC the return will be `cancel`.
### lib.closeAlertDialog
Force closes the active alert dialog and sets its return data as `nil`
<Tabs>
<TabItem value='Lua'>
```lua
lib.closeAlertDialog()
```
</TabItem>
<TabItem value='JS/TS'>
```ts
import lib from '@overextended/ox_lib/client'
lib.closeAlertDialog()
```
</TabItem>
</Tabs>
**Example:**
<Tabs>
<TabItem value='Lua'>
```lua
local alert = lib.alertDialog({
header = 'Hello there',
content = 'General Kenobi \n Markdown support!',
centered = true,
cancel = true
})
print(alert)
```
</TabItem>
<TabItem value='JS/TS'>
```ts
import lib from '@overextended/ox_lib/client'
const alert = await lib.alertDialog({
header: 'Hello there',
content: 'General Kenobi \n Markdown support!',
centered: true,
cancel: true
})
console.log(alert)
```
</TabItem>
</Tabs>
![alert_dialog](https://i.imgur.com/Xlx86aK.png)
@@ -1,279 +0,0 @@
---
title: Input Dialog
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
The input dialog window allows you to take data from the user
by setting input fields.
### lib.inputDialog
<Tabs>
<TabItem value='Lua'>
```lua
lib.inputDialog(heading, rows, options)
```
</TabItem>
<TabItem value='JS/TS'>
```ts
import lib from '@overextended/ox_lib/client'
lib.inputDialog(heading, rows, options)
```
</TabItem>
</Tabs>
* heading: `string`
* rows: `string[]` or `table` (`array`)
* type: `'input'` or `'number'` or `'checkbox'` or `'select'` or `'slider'` or `'color'` or `'multi-select'` or `'date'` or `'date-range'` or `'time'` or `'textarea'`
* options?: `table`(`object`)
* allowCancel: `boolean`
* If true the user will not be able to cancel and close the input dialog until submitted.
Available properties per field type:
* input
* label: `string`
* description?: `string`
* placeholder?: `string`
* icon?: `string`
* required? `boolean`
* disabled?: `boolean`
* default?: `string`
* password?: `boolean`
* min?: `number`
* max?: `number`
* number
* label: `string`
* description?: `string`
* placeholder?: `string`
* icon?: `string`
* required? `boolean`
* disabled?: `boolean`
* default?: `number`
* min?: `number`
* max?: `number`
* checkbox
* label: `string`
* checked?: `boolean`
* disabled?: `boolean`
* required?: `boolean`
* select and multi-select
* label: `string`
* options: `table`(`array`)
* value: `string`
* label?: `string`
* description?: `string`
* placeholder?: `string`
* icon?: `string`
* required? `boolean`
* disabled?: `boolean`
* default?: `string`
* value of the default option.
* clearable?: `boolean`
* slider
* label: `string`
* placeholder?: `string`
* icon?: `string`
* required? `boolean`
* disabled?: `boolean`
* default?: `number`
* min?: `number`
* max?: `number`
* step?: `number`
* color
* label: `string`
* description?: `string`
* placeholder?: `string`
* icon?: `string`
* required? `boolean`
* disabled?: `boolean`
* default?: `string`
* format?: `'hex'` | `'hexa'` | `'rgb'` | `'rgba'` | `'hsl'` | `'hsla'`;
* date
* label: `string`
* description?: `string`
* icon?: `string`
* required? `boolean`
* disabled?: `boolean`
* default?: `string` or `true`
* True defaults to current date
* format?: `string`
* Date format to display in the field
* clearable?: `boolean`
* min?: `string`
* "01/01/2000"
* max?: `string`
* "12/12/2023"
* date-range
* label: `string`
* description?: `string`
* icon?: `string`
* required? `boolean`
* disabled?: `boolean`
* default?: `[string, string]`
* format?: `string`
* Date format to display in the field
* clearable?: `boolean`
* time
* label: `string`
* description?: `string`
* icon?: `string`
* required? `boolean`
* disabled?: `boolean`
* default?: `string`
* format?: `'12'` or `'24'`
* clearable?: `boolean`
* textarea
* label: `string`
* description?: `string`
* placeholder?: `string`
* icon?: `string`
* required? `boolean`
* disabled?: `boolean`
* default?: `number`
* min?: `number`
* Minimum amount of rows the text area will take.
* max?: `number`
* Maxmimum amount of rows the text area will take, when exceeded goes into overflow.
* autosize?: `boolean`
* If true text area will grow with content until max rows are reached.
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...
:::caution
Field types such as `date`, `date-range` and `time` return a unix timestamp on the set value.
:::
### lib.closeInputDialog
Force closes the active input dialog and sets its return data as `nil`
<Tabs>
<TabItem value='Lua'>
```lua
lib.closeInputDialog()
```
</TabItem>
<TabItem value='JS/TS'>
```ts
import lib from '@overextended/ox_lib/client'
lib.closeInputDialog()
```
</TabItem>
</Tabs>
## Usage Example
### Basic
<Tabs>
<TabItem value='Lua'>
```lua
local input = lib.inputDialog('Basic dialog', {'First row', 'Second row'})
if not input then return end
print(input, input[1], input[2])
```
</TabItem>
<TabItem value='JS/TS'>
:::caution
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('Basic dialog', ['First row', 'Second row'])
if (!input) return
console.log(input, input[0], input[1])
```
</TabItem>
</Tabs>
![Example image](https://i.imgur.com/KnZ0sEW.png)
### Advanced
<Tabs>
<TabItem value="Lua">
```lua
local input = lib.inputDialog('Dialog title', {
{type = 'input', label = 'Text input', description = 'Some input description', required = true, min = 4, max = 16},
{type = 'number', label = 'Number input', description = 'Some number description', icon = 'hashtag'},
{type = 'checkbox', label = 'Simple checkbox'},
{type = 'color', label = 'Colour input', default = '#eb4034'},
{type = 'date', label = 'Date input', icon = {'far', 'calendar'}, default = true, format = "DD/MM/YYYY"}
})
print(json.encode(input))
-- Getting r, g and b values from colour picker
local r, g, b = string.match(input[4], "rgb%((%d+), (%d+), (%d+)%)")
-- Transforming unit date return to be used with Lua's os library
local date = input[5] / 1000
```
</TabItem>
<TabItem value="JS/TS">
:::caution
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', [
{type: 'input', label: 'Text input', description: 'Some input description', required: true, min: 3, max: 16},
{type: 'number', label: 'Number input', description: 'Some number description', icon: 'hashtag'},
{type: 'checkbox', label: 'Simple checkbox'},
{type: 'color', label: 'Colour input', default: '#eb4034'},
{type: 'date', label: 'Date input', icon: ['far', 'calendar'], default: true, format: "DD/MM/YYYY"}
]);
console.log(JSON.stringify(input, null, 2));
// Getting r, g and b values from colour picker
const regExp = /rgb\((\d+),\s*(\d+),\s*(\d+)\)/;
const colourInput = input[3];
const color = regExp.exec(colourInput);
if (!color) return
console.log(+color[1], +color[2], +color[3])
```
</TabItem>
</Tabs>
![Example image](https://i.imgur.com/v44YEkC.png)
@@ -1,314 +0,0 @@
---
title: Menu
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
Keyboard navigation menu with specific event functions.
### lib.registerMenu
Registers and caches a menu under the specified id.
<Tabs>
<TabItem value='Lua'>
```lua
lib.registerMenu(data, cb)
```
</TabItem>
<TabItem value='JS/TS'>
```ts
import lib from '@overextended/ox_lib/client'
lib.registerMenu(data, cb)
```
</TabItem>
</Tabs>
* data: `table` (`object`)
* id: `string`
* title: `string`
* options: `table` (`array`)
* label: `string`
* progress?: `number`
* colorScheme?: `string`
* icon?: `string`
* FontAwesome icon that will be displayed on the left side, works the same as notification and textui icons.
* Also supports image urls, png and webp files but are not recommend to use over font awesome icons.
* iconColor?: `string`
* values?: `table` (`Array<string | {label: string; description: string}>`)
* 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
scrollable list.
* description?: `string`
* Displays tooltip below menu on hovered item with provided description.
* defaultIndex?: `number`
* Sets the current index for the list to specified number.
* args?: {[key: `string`]: `any`}
* Allows you to pass any arguments through the button.
* If the button has `values` then `isScroll` is automatically passed.
* If the button has `checked` to either true or false then `isCheck` is automatically passed.
* close?: `boolean`
* If set to false, it won't close the menu upon interacting with this option.
* position?: `'top-left'` or `'top-right'` or `'bottom-left'` or `'bottom-right'`
* Default: `'top-left'`
* disableInput?: `boolean`
* Default: `false`
* canClose: `boolean`
* If set to false the user won't be able to exit the menu without pressing one of the buttons.
* 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.
* 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`})
* cb: `function`(selected: `number`, scrollIndex: `number`, args: {[key: `string`]: `any`})
* Callback function when the menu item is pressed.
### lib.showMenu
Displays the menu with the provided id.
<Tabs>
<TabItem value='Lua'>
```lua
lib.showMenu(id)
```
</TabItem>
<TabItem value='JS/TS'>
```ts
import lib from '@overextended/ox_lib/client'
lib.showMenu(id)
```
</TabItem>
</Tabs>
* id: `string`
### lib.hideMenu
<Tabs>
<TabItem value='Lua'>
```lua
lib.hideMenu(onExit)
```
</TabItem>
<TabItem value='JS/TS'>
```ts
import lib from '@overextended/ox_lib/client'
lib.hideMenu(onExit)
```
</TabItem>
</Tabs>
* onExit?: `boolean`
* If true runs the menu's `onClose` function.
### lib.getOpenMenu
Returns the id of the currently open menu.
<Tabs>
<TabItem value='Lua'>
```lua
lib.getOpenMenu()
```
</TabItem>
<TabItem value='JS/TS'>
```ts
import lib from '@overextended/ox_lib/client'
lib.getOpenMenu()
```
</TabItem>
</Tabs>
### lib.setMenuOptions
<Tabs>
<TabItem value='Lua'>
```lua
lib.setMenuOptions(id, options, index)
```
</TabItem>
<TabItem value='JS/TS'>
```ts
import lib from '@overextended/ox_lib/client'
lib.setMenuOptions(id, options, index)
```
</TabItem>
</Tabs>
* id: `string`
* options: `table` (`object` or `array`)
* index?: `number`
* If specified only sets the options table on the specified options index.
**Example:**
Replaces the 3rd index option of the specified menu
<Tabs>
<TabItem value='Lua'>
```lua
lib.setMenuOptions('some_menu_id', {label = 'New option', icon = 'plus'}, 3)
```
</TabItem>
<TabItem value='JS/TS'>
```ts
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.
:::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'>
```lua
lib.registerMenu({
id = 'some_menu_id',
title = 'Menu title',
position = 'top-right',
onSideScroll = function(selected, scrollIndex, args)
print("Scroll: ", selected, scrollIndex, args)
end,
onSelected = function(selected, secondary, args)
if not secondary then
print("Normal button")
else
if args.isCheck then
print("Check button")
end
if args.isScroll then
print("Scroll button")
end
end
print(selected, secondary, json.encode(args, {indent=true}))
end,
onCheck = function(selected, checked, args)
print("Check: ", selected, checked, args)
end,
onClose = function(keyPressed)
print('Menu closed')
if keyPressed then
print(('Pressed %s to close the menu'):format(keyPressed))
end
end,
options = {
{label = 'Simple button', description = 'It has a description!'},
{label = 'Checkbox button', checked = true},
{label = 'Scroll button with icon', icon = 'arrows-up-down-left-right', values={'hello', 'there'}},
{label = 'Button with args', args = {someArg = 'nice_button'}},
{label = 'List button', values = {'You', 'can', 'side', 'scroll', 'this'}, description = 'It also has a description!'},
{label = 'List button with default index', values = {'You', 'can', 'side', 'scroll', 'this'}, defaultIndex = 5},
{label = 'List button with args', values = {'You', 'can', 'side', 'scroll', 'this'}, args = {someValue = 3, otherValue = 'value'}},
}
}, function(selected, scrollIndex, args)
print(selected, scrollIndex, args)
end)
RegisterCommand('testmenu', function()
lib.showMenu('some_menu_id')
end)
```
</TabItem>
<TabItem value='JS/TS'>
```ts
import lib from '@overextended/ox_lib/client'
lib.registerMenu({
id: 'some_menu_id',
title: 'Menu title',
position: 'top-right',
onSideScroll: (selected, scrollIndex, args) => {
console.log("Scroll: ", selected, scrollIndex, args)
},
onSelected: (selected, secondary, args) => {
if (!secondary) {
console.log("Normal button")
} else {
if (args.isCheck) {
console.log("Check button")
}
if (args.isScroll) {
console.log("Scroll button")
}
}
console.log(selected, secondary, JSON.stringify(args, null, 2))
},
onCheck: (selected, checked, args) => {
console.log("Check: ", selected, checked, args)
},
onClose: (keyPressed) => {
console.log('Menu closed')
if (keyPressed) {
console.log(`Pressed ${keyPressed} to close the menu`)
}
},
options: [
{label: 'Simple button', description: 'It has a description!'},
{label: 'Checkbox button', checked: true},
{label: 'Scroll button with icon', icon: 'arrows-up-down-left-right', values: ['hello', 'there']},
{label: 'Button with args', args: {someArg: 'nice_button'}},
{label: 'List button', values: ['You', 'can', 'side', 'scroll', 'this'], description: 'It also has a description!'},
{label: 'List button with default index', values: ['You', 'can', 'side', 'scroll', 'this'], defaultIndex: 5},
{label: 'List button with args', values: ['You', 'can', 'side', 'scroll', 'this'], args: {someValue: 3, otherValue: 'value'}},
]
}, (selected, scrollIndex, args) => {
console.log(selected, scrollIndex, args)
})
RegisterCommand('testmenu', () => {
lib.showMenu('some_menu_id')
}, false)
```
</TabItem>
</Tabs>
![Example](https://i.imgur.com/2zxbsnN.png)
@@ -1,63 +0,0 @@
---
title: Skill Check
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
### lib.skillCheck
Runs a skill check with the defined difficulty.
<Tabs>
<TabItem value='Lua'>
```lua
lib.skillCheck(difficulty, inputs)
```
</TabItem>
<TabItem value='JS/TS'>
```ts
import lib from '@overextended/ox_lib/client'
lib.skillCheck(difficulty, inputs)
```
</TabItem>
</Tabs>
* difficulty: `easy` or `medium` or `hard` or `object`
* Can set custom difficulty by sending a object instead of string
* { areaSize: `number`, speedMultiplier: `number` }
* easy: { areaSize: 50, speedMultiplier: 1 }
* medium: { areaSize: 40, speedMultiplier: 1.5 }
* hard: { areaSize: 25, speedMultiplier: 1.75 }
* `areaSize` size of the area in degrees.
* Sending an array will chain the checks together and return false if one fails and true if all succeed
* inputs: `string[]`
* Picks a random key from the inputs table to use on each skill check pass.
### Usage Example
<Tabs>
<TabItem value='Lua'>
```lua
local success = lib.skillCheck({'easy', 'easy', {areaSize = 60, speedMultiplier = 2}, 'hard'}, {'w', 'a', 's', 'd'})
```
</TabItem>
<TabItem value='JS/TS'>
```ts
import lib from '@overextended/ox_lib/client'
const success = await lib.skillCheck(['easy', 'easy', {areaSize: 60, speedMultiplier: 2}, 'hard'], ['w', 'a', 's', 'd'])
```
</TabItem>
</Tabs>
![skillcheck_example](https://i.imgur.com/rgfkn0S.png)
@@ -1,129 +0,0 @@
---
title: TextUI
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
### lib.showTextUI
Show the TextUI window.
:::danger
**DO NOT** run this function every tick, it's intented to be used as a toggle.
:::
<Tabs>
<TabItem value='Lua'>
```lua
lib.showTextUI(text, options)
```
</TabItem>
<TabItem value='JS/TS'>
```ts
import lib from '@overextended/ox_lib/client'
lib.showTextUI(text, options)
```
</TabItem>
</Tabs>
* text: `string`
* options?: `table`
* position?: `'right-center'` or `'left-center'` or `'top-center'`
* Default: `'right-center'`
* icon?: `string` or `table` (`array`)
* iconColor?: `string`
* style?: React.CSSProperties
### lib.hideTextUI
Hides the currently visible TextUI window
<Tabs>
<TabItem value='Lua'>
```lua
lib.hideTextUI()
```
</TabItem>
<TabItem value='JS/TS'>
```ts
import lib from '@overextended/ox_lib/client'
lib.hideTextUI()
```
</TabItem>
</Tabs>
### Usage Example
#### Basic
<Tabs>
<TabItem value='Lua'>
```lua
lib.showTextUI('[E] - Fuel vehicle')
```
</TabItem>
<TabItem value='JS/TS'>
```ts
import lib from '@overextended/ox_lib/client'
lib.showTextUI('[E] - Fuel vehicle')
```
</TabItem>
</Tabs>
![basic_example](https://i.imgur.com/uZS40fD.png)
#### Custom styling
<Tabs>
<TabItem value='Lua'>
```lua
lib.showTextUI('[E] - Pick apple', {
position = "top-center",
icon = 'hand',
style = {
borderRadius = 0,
backgroundColor = '#48BB78',
color = 'white'
}
})
```
</TabItem>
<TabItem value='JS/TS'>
```ts
import lib from '@overextended/ox_lib/client'
lib.showTextUI('[E] - Pick apple', {
position: "top-center",
icon: 'hand',
style: {
borderRadius: 0,
backgroundColor: '#48BB78',
color: 'white'
}
})
```
</TabItem>
</Tabs>
![custom_example](https://i.imgur.com/sy9lPC0.png)
-7
View File
@@ -1,7 +0,0 @@
label: Ox Lib
collapsible: true
collapsed: true
link:
type: generated-index
description: A standalone library for providing easily reusable code as importable modules and exports.
position: 3
-23
View File
@@ -1,23 +0,0 @@
# Config
All settings are modified using convars, which need to be executed before the resource starts.
```yaml
# Toggle targeting when pressing the hotkey, instead of holding it down.
setr ox_target:toggleHotkey 0
# Change the key to enable targeting (https://docs.fivem.net/docs/game-references/input-mapper-parameter-ids/keyboard)
setr ox_target:defaultHotkey LMENU
# Draw a sprite (circle) at the centroid of a zone.
setr ox_target:drawSprite 1
# Enable built-in targeting options, e.g. toggling vehicle doors.
setr ox_target:defaults 1
# Enable debugging / testing options, entity outlines, and a raycast indicator.
setr ox_target:debug 0
# Enable / Disable leftclick to select options
setr ox_target:leftClick 1
```
-28
View File
@@ -1,28 +0,0 @@
---
title: Getting started
sidebar_position: 1
slug: ./../
---
## Installation
We always recommend using Git so you can track changes and update easily.
```bash
git clone https://github.com/overextended/ox_target.git
```
Otherwise, download the [latest release](https://github.com/overextended/ox_target/releases).
### Dependencies
- [ox_lib](https://github.com/overextended/ox_lib/)
- Several modules are loaded from ox_lib, most notably the zones module.
### Supported Frameworks
These aren't necessary to run ox_target, but they will add additional features.
- [ox_core](https://github.com/overextended/ox_core)
- [esx](https://github.com/esx-framework/esx-legacy)
- [qb-core](https://github.com/qbcore-framework/qb-core)
-75
View File
@@ -1,75 +0,0 @@
---
keywords: ['execute', 'insert']
title: Insert
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
Inserts a new entry into the database and returns the insert id for the row, if valid.
## Promise
<Tabs>
<TabItem value="1" label="Lua">
```lua
local id = MySQL.insert.await('INSERT INTO `users` (identifier, firstname, lastname) VALUES (?, ?, ?)', {
identifier, firstName, lastName
})
print(id)
```
</TabItem>
<TabItem value="2" label="JS">
```js
const id = await MySQL.insert('INSERT INTO `users` (identifier, firstname, lastname) VALUES (?, ?, ?)', [
identifier, firstName, lastName
])
console.log(id)
```
</TabItem>
</Tabs>
**Aliases**
- `MySQL.Sync.insert`
- `exports.ghmattimysql.executeSync`
- `exports.oxmysql.insert_async`
## Callback
<Tabs>
<TabItem value="1" label="Lua">
```lua
MySQL.insert('INSERT INTO `users` (identifier, firstname, lastname) VALUES (?, ?, ?)', {
identifier, firstName, lastName
}, function(id)
print(id)
end)
```
</TabItem>
<TabItem value="2" label="JS">
```js
MySQL.insert('INSERT INTO `users` (identifier, firstname, lastname) VALUES (?, ?, ?)', [
identifier, firstName, lastName
], (id) => {
console.log(id)
})
```
</TabItem>
</Tabs>
**Aliases**
- `MySQL.Async.insert`
- `exports.ghmattimysql.execute`
- `exports.oxmysql.insert`
-78
View File
@@ -1,78 +0,0 @@
---
title: Prepare
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
The only function that provides true 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
- TINYINT 1 and BIT will not return a boolean
- You can only use ? value placeholders, ?? column placeholders and named placeholders will throw an error
When using SELECT, the return value will match `query`, `single`, or `scalar` depending on the number of columns and rows selected.
## Promise
<Tabs>
<TabItem value="1" label="Lua">
```lua
local response = MySQL.prepare.await('SELECT `firstname`, `lastname` FROM `users` WHERE `identifier` = ?', {
identifier
})
print(json.encode(response, { indent = true, sort_keys = true }))
```
</TabItem>
<TabItem value="2" label="JS">
```js
const response = await MySQL.prepare('SELECT `firstname`, `lastname` FROM `users` WHERE `identifier` = ?', [
identifier
])
console.log(JSON.stringify(response))
```
</TabItem>
</Tabs>
**Aliases**
- `exports.oxmysql.prepare_async`
## Callback
<Tabs>
<TabItem value="1" label="Lua">
```lua
MySQL.prepare('SELECT `firstname`, `lastname` FROM `users` WHERE `identifier` = ?', {
identifier
}, function(response)
print(json.encode(response, { indent = true, sort_keys = true }))
end)
```
</TabItem>
<TabItem value="2" label="JS">
```js
MySQL.prepare('SELECT `firstname`, `lastname` FROM `users` WHERE `identifier` = ?', [
identifier
], (response) => {
console.log(JSON.stringify(response))
})
```
</TabItem>
</Tabs>
**Aliases**
- `exports.oxmysql.prepare`
-93
View File
@@ -1,93 +0,0 @@
---
keywords: ['fetchAll', 'execute']
title: Query
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
When selecting data, returns all matching rows and columns; otherwise, returns data like insertId, affectedRows, etc.
## Promise
<Tabs>
<TabItem value="1" label="Lua">
```lua
local response = MySQL.query.await('SELECT `firstname`, `lastname` FROM `users` WHERE `identifier` = ?', {
identifier
})
if response then
for i = 1, #response do
local row = response[i]
print(row.firstname, row.lastname)
end
end
```
</TabItem>
<TabItem value="2" label="JS">
```js
const response = await MySQL.query('SELECT `firstname`, `lastname` FROM `users` WHERE `identifier` = ?', [
identifier
])
if (response) {
response.forEach((row) => {
console.log(row.identifier, row.firstname, row.lastname)
})
}
```
</TabItem>
</Tabs>
**Aliases**
- `MySQL.Sync.fetchAll`
- `exports.ghmattimysql.execute`
- `exports.oxmysql.query_async`
## Callback
<Tabs>
<TabItem value="1" label="Lua">
```lua
MySQL.query('SELECT `firstname`, `lastname` FROM `users` WHERE `identifier` = ?', {
identifier
}, function(response)
if response then
for i = 1, #response do
local row = response[i]
print(row.firstname, row.lastname)
end
end
end)
```
</TabItem>
<TabItem value="2" label="JS">
```js
MySQL.query('SELECT `firstname`, `lastname` FROM `users` WHERE `identifier` = ?', [
identifier
], (response) => {
if (response) {
response.forEach((row) => {
console.log(row.firstname, row.lastname)
})
}
})
```
</TabItem>
</Tabs>
**Aliases**
- `MySQL.Async.fetchAll`
- `exports.ghmattimysql.execute`
- `exports.oxmysql.query`
-75
View File
@@ -1,75 +0,0 @@
---
keywords: ['scalar', 'fetchScalar']
title: Scalar
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
Returns the first column for a single row.
## Promise
<Tabs>
<TabItem value="1" label="Lua">
```lua
local firstName = MySQL.scalar.await('SELECT `firstname` FROM `users` WHERE `identifier` = ? LIMIT 1', {
identifier
})
print(firstName)
```
</TabItem>
<TabItem value="2" label="JS">
```js
const firstName = await MySQL.scalar('SELECT `firstname` FROM `users` WHERE `identifier` = ? LIMIT 1', [
identifier
])
console.log(firstName)
```
</TabItem>
</Tabs>
**Aliases**
- `MySQL.Sync.fetchScalar`
- `exports.ghmattimysql.scalar`
- `exports.oxmysql.scalar_async`
## Callback
<Tabs>
<TabItem value="1" label="Lua">
```lua
MySQL.scalar('SELECT `firstname` FROM `users` WHERE `identifier` = ? LIMIT 1', {
identifier
}, function(firstName)
print(firstName)
end)
```
</TabItem>
<TabItem value="2" label="JS">
```js
MySQL.scalar('SELECT `firstname` FROM `users` WHERE `identifier` = ? LIMIT 1', [
identifier
], (firstName) => {
console.log(firstName)
})
```
</TabItem>
</Tabs>
**Aliases**
- `MySQL.Async.fetchScalar`
- `exports.ghmattimysql.scalar`
- `exports.oxmysql.scalar`
-78
View File
@@ -1,78 +0,0 @@
---
title: Single
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
Returns all selected columns for a single row.
## Promise
<Tabs>
<TabItem value="1" label="Lua">
```lua
local row = MySQL.single.await('SELECT `firstname`, `lastname` FROM `users` WHERE `identifier` = ? LIMIT 1', {
identifier
})
if not row then return end
print(row.firstname, row.lastname)
```
</TabItem>
<TabItem value="2" label="JS">
```js
const row = await MySQL.single('SELECT `firstname`, `lastname` FROM `users` WHERE `identifier` = ? LIMIT 1', [
identifier
])
if (!row) return;
console.log(row.firstname, row.lastname)
```
</TabItem>
</Tabs>
**Aliases**
- `exports.oxmysql.single_async`
## Callback
<Tabs>
<TabItem value="1" label="Lua">
```lua
MySQL.single('SELECT `firstname`, `lastname` FROM `users` WHERE `identifier` = ? LIMIT 1', {
identifier
}, function(row)
if not row then return end
print(row.firstname, row.lastname)
end)
```
</TabItem>
<TabItem value="2" label="JS">
```js
MySQL.single('SELECT `firstname`, `lastname` FROM `users` WHERE `identifier` = ? LIMIT 1', [
identifier
], (row) => {
if (!row) return;
console.log(row.firstname, row.lastname)
})
```
</TabItem>
</Tabs>
**Aliases**
- `exports.oxmysql.single`
-75
View File
@@ -1,75 +0,0 @@
---
keywords: ['execute']
title: Update
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
Returns the number of rows affected by the query.
## Promise
<Tabs>
<TabItem value="1" label="Lua">
```lua
local affectedRows = MySQL.update.await('UPDATE users SET firstname = ? WHERE identifier = ?', {
newName, identifier
})
print(affectedRows)
```
</TabItem>
<TabItem value="2" label="JS">
```js
const affectedRows = await MySQL.update('UPDATE users SET firstname = ? WHERE identifier = ?', [
newName, identifier
])
console.log(affectedRows)
```
</TabItem>
</Tabs>
**Aliases**
- `MySQL.Sync.execute`
- `exports.ghmattimysql.executeSync`
- `exports.oxmysql.update_async`
## Callback
<Tabs>
<TabItem value="1" label="Lua">
```lua
MySQL.update('UPDATE users SET firstname = ? WHERE identifier = ?', {
newName, identifier
}, function(affectedRows)
print(affectedRows)
end)
```
</TabItem>
<TabItem value="2" label="JS">
```js
MySQL.update('UPDATE users SET firstname = ? WHERE identifier = ?', [
newName, identifier
], (affectedRows) => {
console.log(affectedRows)
})
```
</TabItem>
</Tabs>
**Aliases**
- `MySQL.Async.execute`
- `exports.ghmattimysql.execute`
- `exports.oxmysql.update`
-7
View File
@@ -1,7 +0,0 @@
label: OxMySQL
collapsible: true
collapsed: true
link:
type: generated-index
description: A replacement of mysql-async and ghmattimysql with expanded API and improved compatibility for MySQL 8.
position: 2
-85
View File
@@ -1,85 +0,0 @@
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
const lightCodeTheme = require('prism-react-renderer/themes/github');
const darkCodeTheme = require('prism-react-renderer/themes/oceanicNext');
/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'Overextended',
tagline: 'Official documentation for Overextended resources',
url: 'https://overextended.github.io',
baseUrl: '/',
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
favicon: 'img/ox.ico',
organizationName: 'overextended', // Usually your GitHub org/user name.
projectName: 'overextended.github.io', // Usually your repo name.
// plugins: ['@docusaurus/'],
presets: [
[
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
sidebarPath: require.resolve('./sidebars.js'),
// Please change this to your repo.
editUrl: 'https://github.com/overextended/overextended.github.io/tree/main/',
showLastUpdateTime: true,
},
theme: {
customCss: require.resolve('./src/css/custom.css'),
},
}),
],
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
colorMode: {
defaultMode: 'dark',
disableSwitch: true,
},
navbar: {
title: 'Overextended',
logo: {
alt: 'Ox Logo',
src: '/img/ox_64.png',
width: 32,
height: 32,
},
items: [
{
href: 'https://www.github.com/overextended',
label: 'GitHub',
position: 'left',
},
{
href: 'https://discord.gg/hmcmv3P7YW',
label: 'Discord',
position: 'left',
},
{
type: 'search',
position: 'right',
},
],
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
additionalLanguages: ['lua'],
},
algolia: {
appId: '8XXXVNJ7UW',
apiKey: '3680aeb79049744c6629dd0abd2f5dfe',
indexName: 'overextended',
contextualSearch: true,
},
}),
};
module.exports = config;
+92
View File
@@ -0,0 +1,92 @@
@tailwind components;
@tailwind utilities;
a {
text-decoration: none !important;
}
ul.nx-list-disc {
margin-top: 0 !important;
list-style-type: disc;
}
ul.nx-list-disc li li {
list-style-type: circle;
}
ul.nx-list-disc li li li {
list-style-type: square;
}
:root {
--docsearch-highlight-color: #0ea5e9;
--docsearch-primary-color: #0ea5e9;
}
.DocSearch-Modal {
@apply !rounded-md shadow-none dark:bg-neutral-800;
}
.DocSearch-Button {
@apply m-0 w-52 rounded-md bg-neutral-200 text-gray-800 hover:bg-neutral-200 dark:bg-neutral-800 dark:text-gray-400;
}
.DocSearch-Search-Icon {
@apply !text-gray-800 dark:!text-gray-400;
}
.DocSearch-Button-Key {
@apply bg-gray-400 !bg-none text-gray-800 shadow-none dark:!bg-neutral-900 dark:text-neutral-500;
}
.DocSearch-Commands-Key {
@apply bg-gray-400 !bg-none text-gray-800 shadow-none dark:!bg-neutral-900 dark:text-neutral-500;
}
.DocSearch-Container {
@apply dark:bg-black/50;
}
.DocSearch-Input {
@apply text-gray-400 focus-visible:!ring-transparent focus-visible:ring-offset-0 dark:bg-transparent outline-none;
}
.DocSearch-Form {
@apply shadow-blue-500 dark:bg-neutral-800;
}
.DocSearch-SearchBar {
@apply rounded-md dark:bg-neutral-800;
}
.DocSearch-Dropdown {
@apply dark:bg-neutral-800;
}
.DocSearch-Footer {
@apply shadow-none dark:bg-neutral-800;
}
.DocSearch-Hit-source {
@apply dark:bg-neutral-800;
}
.DocSearch-Hit {
@apply [&>a]:aria-selected:!bg-[var(--docsearch-primary-color)];
}
.DocSearch-Hit > a {
@apply shadow-none dark:bg-neutral-700;
}
.DocSearch-Hit-title {
@apply dark:text-neutral-200;
}
.DocSearch-Hit-icon {
@apply dark:text-neutral-200;
}
.DocSearch-Dropdown::-webkit-scrollbar-thumb {
@apply dark:border-neutral-800 dark:bg-neutral-600 dark:hover:bg-neutral-500;
}
+5
View File
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
+13
View File
@@ -0,0 +1,13 @@
const withNextra = require('nextra')({
theme: 'nextra-theme-docs',
themeConfig: './theme.config.tsx',
});
module.exports = {
...withNextra(),
rewrites: null,
output: 'export',
images: {
unoptimized: true,
},
};
+33 -40
View File
@@ -1,50 +1,43 @@
{
"name": "website",
"version": "0.0.0",
"private": true,
"name": "nextra-docs-template",
"version": "0.0.1",
"description": "Nextra docs template",
"scripts": {
"docusaurus": "docusaurus",
"start": "docusaurus start",
"build": "docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
"serve": "docusaurus serve",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"typecheck": "tsc"
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"repository": {
"type": "git",
"url": "git+https://github.com/shuding/nextra-docs-template.git"
},
"author": "Shu Ding <[email protected]>",
"license": "MIT",
"bugs": {
"url": "https://github.com/shuding/nextra-docs-template/issues"
},
"homepage": "https://github.com/shuding/nextra-docs-template#readme",
"dependencies": {
"@algolia/client-search": "^4.17.0",
"@docusaurus/core": "^2.4.1",
"@docusaurus/preset-classic": "^2.4.1",
"@mdx-js/react": "^1.6.22",
"clsx": "^1.2.1",
"prism-react-renderer": "^1.3.5",
"prismjs": "^1.29.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-icons": "^4.8.0"
"@docsearch/css": "3",
"@docsearch/react": "3",
"@tabler/icons-react": "^2.20.0",
"next": "^13.4.4",
"nextra": "latest",
"nextra-theme-docs": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "^2.4.1",
"@docusaurus/theme-classic": "2.0.0-beta.21",
"@docusaurus/types": "2.0.0-beta.21",
"@tsconfig/docusaurus": "^1.0.7",
"@types/node": "^18.16.14",
"@types/react": "^18.2.6",
"@types/node": "18.11.10",
"autoprefixer": "^10.4.14",
"postcss": "^8.4.24",
"prettier-plugin-tailwindcss": "^0.3.0",
"tailwindcss": "^3.3.2",
"typescript": "^4.9.5"
},
"browserslist": {
"production": [
">0.5%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
"pnpm": {
"patchedDependencies": {
"[email protected]": "patches/[email protected]"
}
}
}
+5
View File
@@ -0,0 +1,5 @@
import '../index.css';
export default function MyApp({ Component, pageProps }) {
return <Component {...pageProps} />;
}
+11
View File
@@ -0,0 +1,11 @@
{
"index": "Introduction",
"guides": "Guides",
"oxmysql": "OxMySQL",
"ox_lib": "Ox Lib",
"support": {
"title": "Support Us",
"type": "page",
"href": "https://overextended.vercel.app/#support-our-team"
}
}
@@ -1,5 +1,3 @@
# Git
Git is a version control system, allowing changes to be effectively tracked, merged, and reverted.
As our resources are hosted on GitHub, it can be incredibly useful to learn how to create your own repository to track changes and keep up-to-date. If you plan on making your own changes to our resources, this will allow you to keep your own changes and prevent loss of data.
@@ -1,4 +1,6 @@
# Node.js
---
title: Node.js
---
Node.js is a JavaScript runtime and is used for building applications. In the context of FiveM it is necessary to bundle resources into a single package that can be ran on both the server and client.
@@ -1,8 +1,10 @@
# pnpm
---
title: pnpm
---
pnpm is a fast and disk space efficient package manager, serving as an alternative to npm and yarn.
- Ensure you have [installed Node.js](./nodejs.md).
- Ensure you have [installed Node.js](./nodejs).
- Open a command-line terminal (e.g. Terminal, Command Prompt).
- Enter `npm install -g pnpm` to globally install the package.
- You can install dependencies with pnpm using `pnpm i`.
+20
View File
@@ -0,0 +1,20 @@
---
title: Introduction
---
import DonateLink from '@components/DonateLink';
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.
## Support our team
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 className="mt-2 flex flex-wrap justify-evenly gap-4">
<DonateLink image="https://avatars.githubusercontent.com/u/65407488?v=4" name="Linden" kofiName="thelindat" />
<DonateLink image="https://avatars.githubusercontent.com/u/39926192?v=4" name="Luke" kofiName="lukewastaken" />
<DonateLink image="https://avatars.githubusercontent.com/u/31368547?v=4" name="DokaDoka" kofiName="dokadoka" />
</div>
+123
View File
@@ -0,0 +1,123 @@
import { Steps, Tabs, Tab } from 'nextra-theme-docs';
import { Callout } from 'nextra/components';
import ResourceLinks from '@components/resource-links';
import { NpmButton } from '@components/button';
<ResourceLinks repo="https://github.com/overextended/ox_core" />
An experimental framework for FiveM. Limited support and breaking changes guaranteed.
<Callout type="warning">
This resource does not have a stable (v1.0) release; breaking changes are likely.
Documentation may not be kept updated in some cases.
</Callout>
## Installation
<Callout type="info">
We **strongly** recommend referring to [Guides](../guides) for setting up Git, Node.js, and pnpm.
</Callout>
<Steps>
### Install all resource dependencies.
- [oxmysql](../oxmysql)
- [ox_lib](../ox_lib/)
- [fivem-appearance](https://github.com/pedr0fontoura/fivem-appearance)
- [ox_appearance](https://github.com/overextended/ox_appearance)
### Download a [release](https://github.com/overextended/ox_core/releases) or build the source code.
```bash
git clone https://github.com/overextended/ox_core.git
cd ox_core/web
pnpm i
pnpm build
```
### Install optional dependencies.
These resources aren't required but provide additional functionality.
- [ox_inventory](../ox_inventory/)
- [npwd](https://github.com/project-error/npwd)
- [pefcl](https://github.com/project-error/pefcl)
### (Optional) Configure pefcl
If using it with ox_inventory, open `pefcl/config.json` and enable framework integration.
```json
"frameworkIntegration": {
"enabled": true,
"resource": "ox_inventory",
"syncInitialBankBalance": false
},
```
</Steps>
## Importing into resources
### Lua
Lua imports can be defined as part of fxmanifest, or loaded with the load function.
<Tabs items={['fxmanifest', 'load']}>
<Tab>
```lua
client_scripts {
'@ox_core/imports/client.lua',
'client/main.lua',
}
server_scripts {
'@oxmysql/lib/MySQL.lua',
'@ox_core/imports/server.lua',
'server/main.lua',
}
```
</Tab>
<Tab>
```lua
local file = ('imports/%s.lua'):format(IsDuplicityVersion() and 'server' or 'client')
local import = LoadResourceFile('ox_core', file)
local chunk = assert(load(import, ('@@ox_core/%s'):format(file)))
chunk()
```
</Tab>
</Tabs>
### JavaScript
To use ox_core with your JS/TS resources you'll need to use our npm package, allowing you to import core functions with full type and intellisense support.
<NpmButton link="https://www.npmjs.com/package/@overextended/ox_core" />
## Config
Resource configuration is handled using [convars](https://docs.fivem.net/docs/scripting-reference/convars/).
```bash
# Players must have a valid identifier to join the server. Used to fetch userid from the database.
set ox:primaryIdentifier "fivem"
# Set the number of active characters a user can have registered.
setr ox:characterSlots 5
# Enables debug and development features. Should only be used in a development environment.
setr ox:debug 0
# Disable death system handle by core.
setr ox:deathSystem 0
# Disable the spawn selection.
setr ox:spawnSelect 0
```
+17
View File
@@ -0,0 +1,17 @@
When ox_core is imported into a resource it will create the `player` global.
If `player` is nil, then the client has not yet selected a character and spawned.
**Example:**
```lua
print(json.encode(player, { indent = true }))
```
- player?: `table`
- name: `string`
- firstname: `string`
- lastname: `string`
- userid: `number`
- charid: `number`
- groups: `table`
- gender: `string`
File renamed without changes.
@@ -1,24 +1,18 @@
---
title: Server
sidebar_position: 1
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import { Tabs, Tab } from 'nextra-theme-docs';
## Ox.GetPlayer
Return an instance of OxPlayer for the given player source.
<Tabs>
<TabItem value='lua' label='Lua'>
<Tabs items={['Lua', 'JS']}>
<Tab>
```lua
local player = Ox.GetPlayer(source)
print(json.encode(player, { indent = true }))
```
</TabItem>
<TabItem value='js/ts' label='JS/TS'>
</Tab>
<Tab>
```ts
import { GetPlayer } from '@overextended/ox_core/server';
@@ -27,14 +21,14 @@ const player = GetPlayer(source);
console.log(JSON.stringify(player));
```
</TabItem>
</Tab>
</Tabs>
## Ox.GetPlayerByFilter
Return the first OxPlayer that matches the filter properties.
<Tabs>
<TabItem value='lua' label='Lua'>
<Tabs items={['Lua', 'JS']}>
<Tab>
```lua
local filter = { phoneNumber = '556-560-6609' }
@@ -42,8 +36,8 @@ local player = Ox.GetPlayerByFilter(filter)
print(json.encode(player, { indent = true }))
```
</TabItem>
<TabItem value='js/ts' label='JS/TS'>
</Tab>
<Tab>
```ts
import { GetPlayerByFilter } from '@overextended/ox_core/server';
@@ -53,7 +47,7 @@ const player = GetPlayerByFilter(filter);
console.log(JSON.stringify(player));
```
</TabItem>
</Tab>
</Tabs>
## Ox.GetPlayers
@@ -61,8 +55,8 @@ console.log(JSON.stringify(player));
Returns an array containing all players. Methods will not be applied if the first argument is false.
Players can be filtered to only return players that match the given properties, or groups.
<Tabs>
<TabItem value='lua' label='Lua'>
<Tabs items={['Lua', 'JS']}>
<Tab>
```lua
-- Get an array containing all players in the police or sheriff groups, with grade 3 or higher.
@@ -75,8 +69,8 @@ for i = 1, #players do
end
```
</TabItem>
<TabItem value='js/ts' label='JS/TS'>
</Tab>
<Tab>
```ts
import { GetPlayers } from '@overextended/ox_core/server';
@@ -91,5 +85,5 @@ for (let i = 0; i < players.length; i++) {
}
```
</TabItem>
</Tab>
</Tabs>
File renamed without changes.
@@ -2,8 +2,7 @@
title: Methods
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import { Tabs, Tab } from 'nextra-theme-docs';
These functions are inherited from the [Player class](../Server/).
File renamed without changes.
File renamed without changes.
File renamed without changes.
+53
View File
@@ -0,0 +1,53 @@
import { Steps } from 'nextra-theme-docs';
import { Callout } from 'nextra/components';
import ResourceLinks from '@components/resource-links';
<ResourceLinks repo="https://github.com/overextended/ox_doorlock" />
A door management resource that can be used standalone or alongside ox_core, qb-core, and es_extended.
## Installation
<Callout type="info">
We **strongly** recommend referring to [Guides](../guides) for setting up Git, Node.js, and pnpm.
</Callout>
<Steps>
### Install all resource dependencies.
- [oxmysql](../oxmysql)
- [ox_lib](../ox_lib/)
### Download a [release](https://github.com/overextended/ox_doorlock/releases) or build the source code.
```bash
git clone https://github.com/overextended/ox_doorlock.git
cd ox_doorlock/web
pnpm i
pnpm build
```
### Install optional dependencies.
These resources aren't required but provide additional functionality.
- [ox_target](../ox_target/) or [qb-target](https://github.com/qbcore-framework/qb-target)
</Steps>
## Opening the UI
If you have installed and started the resource, you can use `/doorlock` to open the UI.
- If the cursor is displayed but not the UI then you have not built it.
- You may not be authorised to use the command.
- Enter `test_ace player.1 command.doorlock` in the server console (replace 1 with your server id).
## Convert doors
Door configuration files written for nui_doorlock (and its fork, qb-doorlock) can be automatically added to your MySQL database.
- Any files with the `.lua` extension placed in the `ox_doorlock/convert` directory will be read on resource start.
- Conversion cannot be guaranteed, especially if the config was not written for nui_doorlock.
+15
View File
@@ -0,0 +1,15 @@
## pickClosestDoor
Attempt to pick the lock of the closest door. Dependant on server-side checks and may fail.
```lua
exports.ox_doorlock:pickClosestDoor()
```
## useClosestDoor
Interact with the closest door. Dependant on server-side checks and may fail.
```lua
exports.ox_doorlock:useClosestDoor()
```
+31
View File
@@ -0,0 +1,31 @@
# Triggers
These events are safe to trigger and handle in other scripts.
## ox_doorlock:setState
Can be triggered to lock or unlock a door.
```
TriggerEvent('ox_doorlock:setState', doorId, state)
```
- doorId: `number`
- state: `0` or `1`
# Handlers
These events shouldn't be triggered by any other scripts.
## ox_doorlock:stateChanged
Triggered when a doors state is updated.
```lua
AddEventHandler('ox_doorlock:stateChanged', function(source, doorId, state, usedItem) end)
```
- source: `number` or `nil`
- doorId: `number`
- state: `0` or `1`
- usedItem: `string` or `false`
+31
View File
@@ -0,0 +1,31 @@
Gets data for a door with the given id, matching the id for the database entry.
## getDoor
```lua
exports.ox_doorlock:getDoor(id)
```
### Parameters
- id: `number`
### Returns
- `table`
Gets data for a door with the given name, matching the name for the database entry.
## getDoorFromName
```lua
exports.ox_doorlock:getDoorFromName(name)
```
### Parameters
- name: `string`
### Returns
- `table`
@@ -1,6 +1,8 @@
# Door Settings
---
title: Door settings
---
### General
## General
- Door name
- Used to easily identify the door.
@@ -23,26 +25,26 @@
- Hide UI
- No indicators (i.e. icon, text) will display on the door.
### Characters
## Characters
- Character Id
- Character identifier used by a framework (i.e. player.charid, xPlayer.identifier, Player.CitizenId).
### Groups
## Groups
- Group
- Framework dependent, referring to jobs, gangs, etc.
- Grade
- The minimum grade to allow access for the group (0 to allow all).
### Items
## Items
- Item
- Name of the item.
- Metadata type
- Requires metadata support (i.e. ox_inventory) to check slot.metadata.type
### Lockpick
## Lockpick
- Difficulty
- Sets the skillcheck difficulty (see [docs](https://overextended.github.io/docs/ox_lib/Interface/Client/skillcheck)).
@@ -50,4 +52,3 @@
- Custom difficulty area size.
- Speed multiplier
- Custom difficulty idicator speed.
+39
View File
@@ -0,0 +1,39 @@
import { Steps } from 'nextra-theme-docs';
import ResourceLinks from '@components/resource-links';
<ResourceLinks repo="https://github.com/overextended/ox_fuel" />
A simple fuel resource meant to replace LegacyFuel or serve as a showcase for using petrol cans as an item.
## Installation
<Steps>
### Install all resource dependencies.
- [ox_lib](../ox_lib/)
- [ox_inventory](../ox_inventory/)
### Download a [release](https://github.com/overextended/ox_fuel/releases) or clone the source code.
```bash
git clone https://github.com/overextended/ox_fuel.git
```
### Install optional dependencies.
These resources aren't required but provide additional functionality.
- [ox_target](../ox_target/)
</Steps>
## Get vehicle fuel amount
```lua
local fuel = Entity(vehicleId).state.fuel
```
## Set vehicle fuel amount
```lua
Entity(vehicleId).state.fuel = fuelAmount
```
@@ -1,6 +1,16 @@
### setMoneyCheck
## setMoneyCheck
Replaces the standard inventory search for "money".
Override the built-in money check.
```lua
exports.ox_fuel:setMoneyCheck(method)
```
### Parameters
- method: `function(): number`
### Example
```lua
exports.ox_fuel:setMoneyCheck(function()
@@ -1,6 +1,16 @@
### setPaymentMethod
## setPaymentMethod
Replaces the standard payment method using "money" as an item.
Override the built-in payment method.
```lua
exports.ox_fuel:setPaymentMethod(method)
```
### Parameters
- method: `function(): boolean?`
### Example
```lua
exports.ox_fuel:setPaymentMethod(function(playerId, amount)
+239
View File
@@ -0,0 +1,239 @@
import ResourceLinks from '@components/resource-links';
import { Steps, Tabs, Tab } from 'nextra-theme-docs';
import { Callout } from 'nextra/components';
<ResourceLinks repo="https://github.com/overextended/ox_inventory" />
A slot-based inventory with item metadata for "item uniqueness".
<Callout type="warning">
If you are replacing a built-in framework inventory there will be compatibility errors.
If you are unwilling or incapable of resolving incompatibilities, do not install this resource.
</Callout>
## Installation
<Callout type="info">
We **strongly** recommend referring to [Guides](../guides) for setting up Git, Node.js, and pnpm.
</Callout>
<Steps>
### Install all resource dependencies
- [oxmysql](../oxmysql)
- [ox_lib](../ox_lib/)
### Download a [release](https://github.com/overextended/ox_inventory/releases) or build the source code.
```bash
git clone https://github.com/overextended/ox_inventory.git
cd ox_inventory/web
pnpm i
pnpm build
```
### Install optional dependencies
These resources aren't required but provide additional functionality.
- [ox_target](../ox_target/)
### Resource start order
It's important for your resources to start in a logical order to prevent errors from missing dependencies.
```bash
start oxmysql # this should be one of the first resources
start ox_lib
start framework # the name of your framework (i.e. ox_core, es_extended, qb-core)
start ox_target
start ox_inventory
```
### Config
Resource configuration is handled using [convars](https://docs.fivem.net/docs/scripting-reference/convars/).
```bash
### Shared
# Activate specific event handlers and functions (supported: ox, esx, qb, nd)
setr inventory:framework "esx"
# Number of slots for player inventories
setr inventory:slots 50
# Maximum carry capacity for players, in grams (frameworks may override this)
setr inventory:weight 30000
# Integrated support for qtarget/ox_target stashes, shops, etc
# Note: qtarget is deprecated, a future update may drop support (ox_target only, or gated features)
setr inventory:target false
# Jobs with access to police armoury, evidence lockers, etc
setr inventory:police ["police", "sheriff"]
### Client
# The URL to load item images from
setr inventory:imagepath "nui://ox_inventory/web/images"
# Weapons will reload after reaching 0 ammo
setr inventory:autoreload false
# Blur the screen while accessing the inventory
setr inventory:screenblur true
# Default hotkeys to access primary and secondary inventories, and hotbar
setr inventory:keys ["F2", "K", "TAB"]
# Enable control action when inventory is open
setr inventory:enablekeys [249]
# Weapons must be aimed before shooting
setr inventory:aimedfiring false
# Show a list of all nearby players when giving items
setr inventory:giveplayerlist false
# Toggle weapon draw/holster animations
setr inventory:weaponanims true
# Toggle item notifications (add/remove)
setr inventory:itemnotify true
# Disable drop markers and spawn a prop instead
setr inventory:dropprops true
# Set the default model used for drop props
setr inventory:dropmodel "prop_med_bag_01b"
# Disarm the player if an unexpected weapon is in use (i.e. did not use the weapon item)
setr inventory:weaponmismatch true
# Ignore weapon mismatch checks for the given weapon type (e.g. ['WEAPON_SHOVEL', 'WEAPON_HANDCUFFS'])
setr inventory:ignoreweapons []
# Suppress weapon and ammo pickups
setr inventory:suppresspickups 1
### Server
# Compare current version to latest release on GitHub
set inventory:versioncheck true
# Stashes will be wiped after remaining unchanged for the given time
set inventory:clearstashes "6 MONTH"
# Discord webhook url, used for imageurl metadata content moderation (image embeds)
set inventory:webhook ""
# Logging via ox_lib (0: Disable, 1: Standard, 2: Include AddItem/RemoveItem, and all shop purchases)
set inventory:loglevel 1
# Item prices fluctuate in shops
set inventory:randomprices true
# Loot will randomly generate inside unowned vehicles and dumpsters
set inventory:randomloot true
# Minimum job grade to remove items from evidence lockers
set inventory:evidencegrade 2
# Trim whitespace from vehicle plates when checking owned vehicles
setr inventory:trimplate true
# Set the contents of randomly generated inventories
# [item name, minimum, maximum, loot chance]
set inventory:vehicleloot [
["cola", 1, 1],
["water", 1, 1],
["garbage", 1, 2, 50],
["panties", 1, 1, 5],
["money", 1, 50],
["money", 200, 400, 5],
["bandage", 1, 1]
]
set inventory:dumpsterloot [
["mustard", 1, 1],
["garbage", 1, 3],
["money", 1, 10],
["burger", 1, 1]
]
```
</Steps>
## Framework incompatibilities
- Any frameworks with their own built-in inventory, item, or weapon systems are expected to have compatibility issues.
- Money as an item may conflict with banking/account systems.
- You can sync these values with [server.syncInventory](https://github.com/overextended/ox_inventory/blob/aff8ef9e9ee3f93f177ce03b3f37895ff5781800/modules/bridge/nd/server.lua#L64-L77).
Refer to issue [#1297](https://github.com/overextended/ox_inventory/issues/1297) for known compatibility issues.
## Using an unsupported framework
If your framework does not have official support you'll have to implement it yourself.
If you're replacing an existing/built-in inventory system this may be complicated, but is a fairly simple task otherwise.
This setup is highly opinionated and rigid, so it's up to your own ability as a developer to make it work.
<Steps>
### Setup a bridge submodule
You'll want to set the target framework first - this could be the name, an acronym, or just "custom".
```bash
setr inventory:framework "custom"
```
Copy the `ox` directory from the [bridge](https://github.com/overextended/ox_inventory/tree/main/modules/bridge) directory and give it the name you used above.
The bare minimum functions and event handlers are added here, but you'll need to change them to match your framework; we can't provide any help here. You can refer to the other framework bridges if you need inspiration.
### Setup database references
Take a look at the [mysql](https://github.com/overextended/ox_inventory/blob/main/modules/mysql/server.lua) module. You'll need to reference your player/vehicle tables and id columns.
```lua
elseif shared.framework == 'custom' then
playerTable = 'characters' -- table storing player / character data
playerColumn = 'charid' -- primary key for identifying the character (i.e. identifier, citizenid, id)
vehicleTable = 'vehicles' -- table storing owned vehicle data
vehicleColumn = 'id' -- primary key for identifying the vehicle (i.e. plate, vin, id)
end
```
</Steps>
## ESX
- You will need a [compatible version of ESX Legacy](https://github.com/esx-framework/esx_core) (1.6.0 or higher).
- You can convert player inventories with `convertinventory esx`.
- All items in the database will be migrated to the internal item data.
- Always restart the resource when items are migrated!
## QBCore
<Callout type="warning">Support for QBCore is extremely limited, highly incompatible, and unlikely to improve.</Callout>
- You can use any "version" of qb-core that supports `QBCore.Functions.AddPlayerMethod`.
- You can convert player and vehicle inventories with `convertinventory qb`.
- All QB.Shared.Items will be migrated to the internal item data.
- Always restart the resource when items are migrated!
### Qbox Project
- [Qbox Project GitHub](https://github.com/Qbox-project/)
- [Qbox txAdmin Recipe](https://github.com/Qbox-project/txAdminRecipe)
Qbox is a fork of QBCore developed by former team members and contributors to QBCore.
- Improved security and performance of qb resources.
- Integrated support for ox_inventory, with improved compatibility.
- Support for ox_lib and ox_target.
File renamed without changes.
File renamed without changes.
@@ -1,7 +1,8 @@
# ESX
---
title: ESX
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import { Tabs, Tab } from 'nextra-theme-docs';
## Compatibility
@@ -24,28 +25,12 @@ start qtarget
start ox_inventory
```
<Tabs>
<TabItem value="fresh" label="Clean install" default>
- No extra steps required.
</TabItem>
<TabItem value="convert_esx" label="Convert ESX">
## Convert ESX inventory data
- Start the server and type `convertinventory esx` into the server console.
- Optionally, type `convertinventory esxproperty` into the server console.
- Restart the server once conversion is complete.
</TabItem>
<TabItem value="convert_linden" label="Upgrade from Linden Inventory">
- Execute the query inside [upgrade.sql](https://github.com/overextended/ox_inventory/blob/main/setup/upgrade.sql).
- Start the server and type `convertinventory linden` into the server console.
- Restart the server once conversion is complete.
</TabItem>
</Tabs>
## Optional optimisation
All item related functions from xPlayer, such as `xPlayer.getInventoryItem`, have been modified for compatibility purposes; however they are considered deprecated.
@@ -54,8 +39,8 @@ The reasoning is fairly simple - there's now additional function references and
You should read through the functions section for further information, but the following should give you a decent idea.
<Tabs>
<TabItem value="esx" label="ESX">
<Tabs items={["ESX", "Ox Inventory"]}>
<Tab>
```lua
if xPlayer.getInventoryItem('acetone').count > 2 and xPlayer.getInventoryItem('antifreeze').count > 4 and xPlayer.getInventoryItem('sudo').count > 9 then
@@ -65,8 +50,8 @@ if xPlayer.getInventoryItem('acetone').count > 2 and xPlayer.getInventoryItem('a
end
```
</TabItem>
<TabItem value="inventory" label="Inventory">
</Tab>
<Tab>
Add the following code somewhere in your resource to cache the exports metatable.
@@ -85,5 +70,5 @@ if items and items.acetone > 2 and items.antifreeze > 4 and items.sudo > 9 then
end
```
</TabItem>
</Tab>
</Tabs>
@@ -1,9 +1,15 @@
# QBCore
---
title: QBCore
---
:::warning
import { Callout } from 'nextra/components';
import { Tabs, Tab } from 'nextra-theme-docs';
<Callout type="warning">
QBCore support is experimental and cannot work as a "drag and drop" solution due to many incompatibilities.
:::
</Callout>
## Compatibility
@@ -45,8 +51,8 @@ The reasoning is fairly simple - there's now additional function references and
You should read through the functions section for further information, but the following should give you a decent idea.
<Tabs>
<TabItem value="qb" label="QBCore">
<Tabs items={["QBCore", "Ox Inventory"]}>
<Tab>
```lua
local acetone = Player.Functions.GetItemByName('acetone')
@@ -59,8 +65,8 @@ if acetone?.amount > 2 and antifreeze?.amount > 4 and sudo?.amount > 9 then
end
```
</TabItem>
<TabItem value="inventory" label="Inventory">
</Tab>
<Tab>
Add the following code somewhere in your resource to cache the exports metatable.
@@ -79,5 +85,5 @@ if items and items.acetone > 2 and items.antifreeze > 4 and items.sudo > 9 then
end
```
</TabItem>
</Tab>
</Tabs>
@@ -2,8 +2,7 @@
keywords: ['hasitem']
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import { Tabs, Tab } from 'nextra-theme-docs';
Searches the inventory for an item, or list of items, with the result varying based on the first argument.
@@ -22,16 +21,16 @@ exports.ox_inventory:Search(search, item, metadata)
### Count
<Tabs>
<TabItem value="1" label="Single item">
<Tabs items={["Single item", "Multiple items"]}>
<Tab>
```lua
local count = exports.ox_inventory:Search('count', 'water')
print('You have '..count.. ' water')
```
</TabItem>
<TabItem value="2" label="Multiple items">
</Tab>
<Tab>
```lua
local inventory = exports.ox_inventory:Search('count', {'meat', 'skin'}, {grade="1"})
@@ -43,13 +42,13 @@ if inventory then
end
```
</TabItem>
</Tab>
</Tabs>
### Slots
<Tabs>
<TabItem value="1" label="Single item">
<Tabs items={["Single item", "Multiple items"]}>
<Tab>
```lua
local water = exports.ox_inventory:Search('slots', 'water')
@@ -61,8 +60,8 @@ end
print('You have '..count..' water')
```
</TabItem>
<TabItem value="2" label="Multiple items">
</Tab>
<Tab>
```lua
local items = exports.ox_inventory:Search('slots', {'meat', 'skin'}, 'deer')
@@ -81,5 +80,5 @@ if items then
end
```
</TabItem>
</Tab>
</Tabs>
Loaded 100 of 229 files, more files were not shown because too many files have changed in this diff. Show more