From 7f99ef97e1b394a45f831949131cf53c582fbbfa Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Thu, 14 Jul 2022 15:07:31 +1000 Subject: [PATCH] ox_core config and usage --- docs/ox_core/Getting Started/config.md | 20 +++++++++ docs/ox_core/Getting Started/imports.md | 48 +++++++++++++++++++++ docs/ox_core/{ => Getting Started}/index.md | 32 +------------- 3 files changed, 69 insertions(+), 31 deletions(-) create mode 100644 docs/ox_core/Getting Started/config.md create mode 100644 docs/ox_core/Getting Started/imports.md rename docs/ox_core/{ => Getting Started}/index.md (67%) diff --git a/docs/ox_core/Getting Started/config.md b/docs/ox_core/Getting Started/config.md new file mode 100644 index 00000000..c7a0fe51 --- /dev/null +++ b/docs/ox_core/Getting Started/config.md @@ -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 | diff --git a/docs/ox_core/Getting Started/imports.md b/docs/ox_core/Getting Started/imports.md new file mode 100644 index 00000000..cd056fda --- /dev/null +++ b/docs/ox_core/Getting Started/imports.md @@ -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. + + + + +```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', +} +``` + + + + +```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() +``` + + + + +## 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. + + +}>Package + diff --git a/docs/ox_core/index.md b/docs/ox_core/Getting Started/index.md similarity index 67% rename from docs/ox_core/index.md rename to docs/ox_core/Getting Started/index.md index a7d4c220..ddca473d 100644 --- a/docs/ox_core/index.md +++ b/docs/ox_core/Getting Started/index.md @@ -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 - - -## Convars - -| Name | Default | Replicated | -|------|------------|---------| -| ox:primaryIdentifier | fivem | false - -## Importing the core functions - - - -Functions are imported by simply adding the import files to the fxmanifest. - -**Client:** -`@ox_core/imports/client.lua` - -**Server:** -`@ox_core/imports/server.lua` - - -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. - - -}>Package - - - \ No newline at end of file