ox_core config and usage

This commit is contained in:
Linden committed 2022-07-14 15:07:31 +10:00
1 parent 95e29e715e
commit 7f99ef97e1
3 files changed
+69 -31

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
# Config
## Convars
| Name | Default | Replicated |
| -------------------- | ------- | ---------- |
| ox:primaryIdentifier | fivem | false |
| ox:characterSlots | 5 | true |
## Convar overrides
Convars for other resources are set when ox_core starts.
| Name | Value | Replicated |
| ----------------------------------- | ------------------------------------------------------- | ---------- |
| inventory:framework | ox | true |
| inventory:trimplate | 5 | true |
| pe-basicloading:disableAutoShutdown | 1 | true |
| npwd:useResourceIntegration | true | false |
| npwd:database | {playerTable: "characters", identifierColumn: "charid"} | false |
+48
View File
@@ -0,0 +1,48 @@
# 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>
@@ -1,12 +1,11 @@
---
title: Getting started
sidebar_position: 1
slug: ./../
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import IconButton from '@site/src/components/IconButton';
import { FaNpm } from 'react-icons/fa';
:::caution
@@ -61,32 +60,3 @@ pnpm build
</TabItem>
</Tabs>
## Convars
| Name | Default | Replicated |
|------|------------|---------|
| ox:primaryIdentifier | fivem | false
## Importing the core functions
<Tabs>
<TabItem value='lua' label='Lua'>
Functions are imported by simply adding the import files to the fxmanifest.
**Client:**
`@ox_core/imports/client.lua`
**Server:**
`@ox_core/imports/server.lua`
</TabItem>
<TabItem value='js/ts' label='JS/TS'>
If in case you want to write resources in JS/TS you will need to insteall 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>
</TabItem>
</Tabs>