Skip to content

Commit

Permalink
feat: overhaul (#12)
Browse files Browse the repository at this point in the history
- Improve existing documentation.
- Add some missing documentation.
- Partially standardize code styling and other stuff.
- Remove docs for heavily WIP resources (ambulancejob & medical).
  • Loading branch information
D4isDAVID authored Jan 28, 2024
1 parent ff34976 commit 724a69d
Show file tree
Hide file tree
Showing 65 changed files with 2,270 additions and 2,071 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.next
node_modules
out
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# Nextra Docs Template

This is a template for creating documentation with [Nextra](https://nextra.site).
# Qbox Project Documentation

## Local Development

First, run `pnpm i` to install the dependencies.

Then, run `pnpm dev` to start the development server and visit localhost:3000.

## Acknowledgements

- [`shuding/nextra-docs-template`](https://github.com/shuding/nextra-docs-template) - the template used
- [`overextended/overextended.github.io`](https://github.com/overextended/overextended.github.io) - much of the styling copied over from here
6 changes: 0 additions & 6 deletions components/counters.module.css

This file was deleted.

24 changes: 0 additions & 24 deletions components/counters.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const withNextra = require('nextra')({

module.exports = {
...withNextra(),
rewrites: null,
rewrites: undefined,
output: 'export',
images: {
unoptimized: true,
Expand Down
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@
},
"homepage": "https://github.com/shuding/nextra-docs-template#readme",
"dependencies": {
"next": "^13.0.6",
"nextra": "latest",
"nextra-theme-docs": "latest",
"@tabler/icons-react": "^2.46.0",
"next": "^13.5.6",
"nextra": "^2.12.3",
"nextra-theme-docs": "^2.12.3",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/node": "18.11.10",
"@types/react": "^18.2.13",
"@types/react-dom": "^18.2.6",
"typescript": "^4.9.3"
"@types/node": "18.19.8",
"@types/react": "^18.2.48",
"@types/react-dom": "^18.2.18",
"typescript": "^5.3.3"
}
}
6 changes: 0 additions & 6 deletions pages/_app.js

This file was deleted.

5 changes: 5 additions & 0 deletions pages/_app.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import '../style.css';

export default function App({ Component, pageProps }) {
return <Component {...pageProps} />;
}
2 changes: 1 addition & 1 deletion pages/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"index": "Introduction",
"installation": "Installation",
"resources": "Resources",
"converting": "Converting from QB",
"converting": "Converting from QBCore",
"contributors": "Contributing",
"developers": "Developer's Guide",
"release": "Release Readiness",
Expand Down
37 changes: 25 additions & 12 deletions pages/converting.mdx
Original file line number Diff line number Diff line change
@@ -1,21 +1,34 @@
# Converting to Qbox from Qb
# Converting from QBCore

1. Check your job grades in `qbx_core/shared/jobs.lua`. In Qbox, job grades are numbers without quotations, whereas in Qb they are strings.
2. Configure ox_inventory and convert your database. Back it up first! https://overextended.dev/ox_inventory/Frameworks/qb
3. Qbox has multicharacter built-in to core. If you want to keep using your own multicharacter resource, disable core's via core config. Otherwise delete your multicharacter resource.
4. Qbox maintains a qb compatibility layer, so you can continue to use exports['qb-core'] and it should have full compatibibility. However, this means you won't get access to all the Qbox features and functions. So consider switching off of exports['qb-core'] when you can. This bridge layer means that qb-core resources should be 100% compatible with Qbox.
1. Check your job grades in `qbx_core/shared/jobs.lua`.
In Qbox, job grades are numbers without quotations, whereas in QBCore they are strings.
2. Configure ox_inventory and convert your database.
Back it up first! ([see ox_inventory documentation](https://overextended.dev/ox_inventory/Frameworks/qb))
3. Qbox has multicharacter built into qbx_core.
If you want to keep using your own multicharacter resource, configure qbx_core accordingly.
Otherwise you can disable or delete your old multicharacter resource.
4. Qbox has a queue system built into qbx_core.
If you want to keep using your own queue system, specify `set qbx:enablequeue "true"` inside your cfg file.
Otherwise you can disable or delete your old queue system.
5. Qbox maintains a qb-core compatibility layer so all existing qb-core resources should expect compatibility most times.
You can continue using `exports['qb-core']`, however, this means you won't get access to all the new Qbox features and functions, so consider switching off of `exports['qb-core']` when you can.
Do note that undocumented and invalid usages of qb-core are not supported and may not be in the future.
See the [FAQ](./faq#will-my-qbcore-scripts-work-with-qbox) for more details.

## Switching a resource from Qb to Qbox
Within Qbox the core object no longer exists. Instead the data can be accessed via a combination of export functions and imported modules
## Migrating a resource from QBCore to Qbox

1. Import the needed modules from qbx_core to supply replacement functions for ones from QBCore
Within Qbox, the core object no longer exists.
Instead, the data can be accessed via a combination of export functions and imported modules.

1. Import the needed modules from qbx_core to supply replacement functions for ones from QBCore;
2. Replace calls to QBCore one by one with calls to the imported modules and exported functions. Both can be used at the same time, so conversion can be done partially, or over time.

### Common replacements

```lua
QBCore.Functions. -> exports.qbx_core:
QBCore.Functions.GetPlayerData() -> QBX.PlayerData (requires playerdata module import)
QBCore.Functions.GetPlate -> GetPlate (requires utils module import)
QBCore.Functions.GetPlayerData() -> QBX.PlayerData -- requires importing the playerdata module
QBCore.Functions.GetPlate(vehicle) -> qbx.getVehiclePlate(vehicle) -- requires importing the lib module
QBCore.Shared.Jobs -> exports.qbx_core:GetJobs()
QBCore.Shared.Gangs -> exports.qbx_core:GetGangs()
QBCore.Shared.Vehicles -> exports.qbx_core:GetVehiclesByName()
Expand All @@ -25,6 +38,6 @@ QBCore.Shared.Items -> exports.ox_inventory:Items()

exports['qb-core']:KeyPressed() -> lib.hideTextUI()
exports['qb-core']:HideText() -> lib.hideTextUI()
exports['qb-core']:DrawText(text, position) -> lib.showTextUI(text, {position = position})
exports['qb-core']:ChangeText(text, position) -> lib.hideTextUI() lib.showTextUI(text, {position = position})
exports['qb-core']:DrawText(text, position) -> lib.showTextUI(text, { position = position })
exports['qb-core']:ChangeText(text, position) -> lib.hideTextUI() lib.showTextUI(text, { position = position })
```
14 changes: 9 additions & 5 deletions pages/developers.mdx
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
# Developer's Guide

This guide is intended for those creating scripts using qbx_core. Following these principles will make it less likely for your
script to break in future Qbox updates.
This guide is intended for those creating scripts using qbx_core.
Following these principles will make it less likely for your script to break in future updates.

## Do not access database tables owned by core

Doing this will break your script if the database schema changes in the future. If the data you need can't be read or written using a core function,
Doing this will break your script if the database schema changes in the future.
If the data you need can't be read or written using a core function,
create a GitHub issue so we can rectify the problem for everyone.

## Do not modify core code

Doing this will make it difficult for you to update core and make it difficult to debug issues that may be due to custom changes. We've attempted to design things with flexibility in mind.
However, if you really think you need to modify core, file a GitHub issue first, and we'll see if we can trigger an event for you, surface a config value, or re-design something for the flexibility you need.
Doing this will make it difficult for you to update in the future, and create confusion when debugging issues that may or may not be due to your custom changes.

We've attempted to design things with flexibility in mind. \
However, if you really feel you need to modify core, file a GitHub issue first.
We'll see if we can trigger an event for you, surface a config value, or re-design something for the flexibility you need.

## Do not use deprecated functions/events

Expand Down
49 changes: 29 additions & 20 deletions pages/faq.mdx
Original file line number Diff line number Diff line change
@@ -1,35 +1,44 @@
# Frequently Asked Questions

## What are the differences between Qb and Qbox?
## What are the differences between QBCore and Qbox?

While originally forked from Qb, many Qbox resources have been refactored to improve code quality, enhance security, lower performance overhead, and integrate with [overextended](https://overextended.dev) resources.
Where appropriate Qbox also integrates directly with other open source projects, rather than maintain subpar resources in-house.
Qbox maintains high quality standards, with a strong community of regular contributors. As time goes on, expect greater differences in player facing features.
While originally forked from QBCore, many Qbox resources have been refactored to improve code quality, enhance security, lower performance overhead, and integrate with [overextended](https://overextended.dev) resources.
Where appropriate Qbox also integrates directly with other open source projects, rather than maintaining subpar resources in-house.

## Will Qb compatible scripts work with Qbox?
Qbox maintains high quality standards, with a strong community of regular contributors.
As time goes on, expect greater differences in player facing features.

Yes. We've created a bridge layer for backwards compatibility with Qb scripts. You can continue to use Qb scripts without any modifications.
## Will my QBCore scripts work with Qbox?

## When will Qbox get a stable release?
TL;DR: Yes (in most cases).

Expect individual resources to get versioned releases over the coming months as they get stabilized and tested.
We've created a bridge layer for backwards compatibility with the documented and proper ways of using qb-core,
and you can continue to use most QBCore scripts without any modifications.

An exception to this is resources that use qb-core in undocumented, unsupported, invalid, and/or improper ways, such as:
- Direct access to database tables;
- Direct access to qb-core files that aren't meant to be used by other resources;
- Invalid usages of existing functions;
- And other unexpected ways not mentioned here.

## Who should use Qbox?

Servers currently using QB and servers interested in running QB resources in the future
Servers currently using QBCore and servers interested in running QBCore in the future.

## Is Qbox ready to use?

Since qbx_core is backwards compatible with qb-core resources, we recommend using only the released Qbox resources for a stable experience.

## Is Qbox ready to be used?
Since qbx_core is backwards compatible with qb resources, we recommend using the released qbox resources only for a stable experience.
## Which resources are ready to use?

## Which resources are released?
- [qbx_core](./resources/qbx_core)
- [qbx_divegear](./resources/qbx_divegear)
- [qbx_diving](./resources/qbx_diving)
- [qbx_binoculars](./resources/qbx_binoculars)
- [qbx_management](./resources/qbx_management)

qbx_core
qbx_divegear
qbx_diving
qbx_binoculars
qbx_management
## Common Problems

# Common Problems
### No such export GetCoreObject in resource qbx_core

## No Such export GetCoreObject in resource qbx_core
Qbox does not have the core object. However, you can continue to use exports['qb-core']:GetCoreObject() to get a core object from Qbox's QB bridge layer.
Qbox does not have the core object. However, you can continue to use `exports['qb-core']:GetCoreObject()` to get a core object from Qbox's QB bridge layer.
38 changes: 26 additions & 12 deletions pages/index.mdx
Original file line number Diff line number Diff line change
@@ -1,21 +1,35 @@
import { Callout } from 'nextra/components'

# Introduction

Qbox is a FiveM roleplay framework. This framework strives to be greater and combines with [overextended's resources](https://github.com/overextended) to achieve this greatness. Come witness the greatness and be overwhelmed by it!
Qbox is a FiveM roleplay framework created on September 27, 2022.

<Callout>
Qbox was created on September 27, 2022.
This project started as a fork of QBCore with a goal of making improvements while maintaining backwards compatibility.
</Callout>
Starting as a QBCore fork, its goal was improving upon QBCore while maintaining backwards compatibility. \
Today this framework strives to be much greater, and utilizes [overextended's resources](https://github.com/overextended) to achieve its goals.

## Contributing
## Support & Questions

Contributions are always welcome, but we prefer quality over quantity! Please read our [contributing guidelines](https://qbox-project.github.io/contributors) to learn how best to contribute.
Support for Qbox is provided by the community in the support channels of the [Qbox Discord](https://discord.gg/qbox).

Luckily, Qbox benefits from a great community with varied experience.
We encourage everyone to help each other in a friendly and respectable manner.

## Support
## Converting from QBCore

Support for Qbox is provided by the community in the support channels of the [Qbox Discord](https://discord.gg/qbox).
Already have a server that uses QBCore? No worries!
Qbox has backwards-compatibility for almost all QBCore scripts, with a few exceptions (learn more in the [FAQ](./faq#will-my-qbcore-scripts-work-with-qbox)).

Planning on converting to Qbox anyway to be able to utilize its new and modern functions and features?
Learn how to convert your resources to Qbox in [Converting from QBCore](./converting).

## Note for Developers

Planning on utilizing qbx_core in your next resource?
Make sure to read the [Developer's Guide](./developers) to learn about principles that make you avoid bad practices and help you in having a better developer expetience.

## Contributing to Qbox

Contributions are always welcome, but we prefer quality over quantity!
Please read our [contributing guidelines](https://qbox-project.github.io/contributors) to learn how best to contribute.

## Frequently Asked Questions

Luckily, Qbox benefits from a great community with varied experience. We encourage everyone to help each other in a friendly and respectable manner.
Check out the [FAQ](./faq) to learn more about Qbox.
56 changes: 28 additions & 28 deletions pages/installation.mdx
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
import { Callout, Steps, Tabs } from 'nextra/components'

# Installation
<Callout type="info" emoji="ℹ️">
We highly recommend using **txAdmin** to install your FiveM server.
For detailed instructions, refer to [Setting up a server](https://docs.fivem.net/docs/server-manual/setting-up-a-server-txadmin/).

<Callout type="info">
We highly recommend using **txAdmin** to install your FiveM server. \
For detailed instructions, refer to [Setting up a server using txAdmin](https://docs.fivem.net/docs/server-manual/setting-up-a-server-txadmin/).
</Callout>

<Steps>
### Download the server
1. Download the latest [FiveM artifacts](https://runtime.fivem.net/artifacts/fivem/build_server_windows/master/) and extract the files.
### Download the server

Download the latest [FiveM artifacts](https://runtime.fivem.net/artifacts/fivem/build_server_windows/master/) and extract the files.

### Start the server installation
Run `FXServer.exe` to begin the installation and follow all the steps.
### Start the server installation

### Deploy the recipe
When prompted, select `Remote URL Template`

Run `FXServer.exe` to begin the installation and follow all the steps.

![Deployment Type](/txadmin-deployment-type.jpg)
### Deploy the recipe

When prompted, select `Remote URL Template`:

Use the raw recipe link shown below.
![Deployment Type](/txadmin-deployment-type.jpg)

<Tabs items={['QBox', 'Qbox Lean']} defaultIndex="0">
<Tabs.Tab>
```ansi filename="Qbox recipe" copy
https://raw.githubusercontent.com/Qbox-project/txAdminRecipe/main/qbox.yaml
```
</Tabs.Tab>
<Tabs.Tab>
```ansi filename="Qbox Lean recipe" copy
https://raw.githubusercontent.com/Qbox-project/txAdminRecipe/main/qbox-lean.yaml
```
</Tabs.Tab>
</Tabs>
Use the raw recipe link shown below.

### Run the server
<Tabs items={['Qbox', 'Qbox Lean']} defaultIndex="0">
<Tabs.Tab>
```ansi filename="Qbox recipe" copy
https://raw.githubusercontent.com/Qbox-project/txAdminRecipe/main/qbox.yaml
```
</Tabs.Tab>
<Tabs.Tab>
```ansi filename="Qbox Lean recipe" copy
https://raw.githubusercontent.com/Qbox-project/txAdminRecipe/main/qbox-lean.yaml
```
</Tabs.Tab>
</Tabs>

Once you have completed all of the installation steps, run the server.
### Run the server

</Steps>
Once you have completed all of the installation steps, run the server.
</Steps>
Loading

0 comments on commit 724a69d

Please sign in to comment.