Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation Fixes and Reorganization #501

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions content/docs/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ Welcome to the documentation for the [FiveM][home] modification framework. Use t

## Asset developers
* 🧐 Get started developing assets for FiveM using our [🧰 Cfx.re Development Kit](./fxdk),
learn what [🎯 resources](./scripting-manual/introduction/introduction-to-resources) are, or get started with [📟 scripting](./scripting-manual/introduction) for FiveM.
learn what [🎯 resources](./developers/scripting-manual/introduction/introduction-to-resources) are, or get started with [📟 scripting](./developers/scripting-manual/introduction) for FiveM.
* 📚 Look at the [🏞 native reference](/natives/) to find functions to use.
* 🤯 Already experienced with development? Check out the [🧾 fact sheet](./scripting-manual/introduction/fact-sheet) to get some quick info.
* 📒 There's helpful [🥑 guides](./scripting-reference/) for scripting, or [👽 a reference](./game-references/) of game-related information.
* 🤯 Already experienced with development? Check out the [🧾 fact sheet](./developers/scripting-manual/introduction/fact-sheet) to get some quick info.
* 📒 There's helpful [🥑 guides](./developers/scripting-reference/) for scripting, or [👽 a reference](./game-references/) of game-related information.

[home]: https://fivem.net
[forum]: https://forum.cfx.re
Expand Down
2 changes: 1 addition & 1 deletion content/docs/client-manual/console-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -392,4 +392,4 @@ Example: `test_ace group.admin command.adminstuff`

[faq-data]: https://support.cfx.re/hc/en-us/articles/8016397932444-Client-FAQ#where-is-fivem-installed
[vconsole]: https://forum.cfx.re/t/20005
[manifest-reference]: /docs/scripting-reference/resource-manifest/resource-manifest/
[manifest-reference]: /docs/developers/scripting-reference/resource-manifest/resource-manifest/
2 changes: 1 addition & 1 deletion content/docs/client-manual/crosshair.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,4 @@ The crosshair can be disabled from the server by entering the following line in
setr cl_customCrosshair false
```

Entering said line will set the [convar](https://docs.fivem.net/docs/scripting-reference/convars/#standard-convars) (console variable) as a [replicated variable](https://docs.fivem.net/docs/scripting-reference/convars/#using-commands-1) set to `false`.
Entering said line will set the [convar](https://docs.fivem.net/docs/developers/scripting-reference/convars/#standard-convars) (console variable) as a [replicated variable](https://docs.fivem.net/docs/developers/scripting-reference/convars/#using-commands-1) set to `false`.
24 changes: 19 additions & 5 deletions content/docs/developers/_index.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
---
title: Developer docs
weight: 900
weight: 500
---

This section of the documentation is specific to the core mechanics of FiveM.
## Welcome to the Developer Documentation

- [Coding guidelines](/docs/developers/coding-guidelines)
This section provides comprehensive coverage of topics ranging from core FiveM mechanics to advanced event handling.

- [Compiling FiveM](/docs/developers/compiling-fivem)
### Where to Start

- [Script runtimes](/docs/developers/script-runtimes)
If you’re new to scripting, we highly recommend starting with **[Guides for Scripting](/docs/developers/scripting-manual)**. This will introduce you to the fundamentals and help you build a solid foundation.

### Explore Further

- **[Guides for Scripting](/docs/developers/scripting-manual)**
Step-by-step tutorials and practical examples to help you get started.

- **[Script Runtimes](/docs/developers/script-runtimes)**
Learn about the different runtimes available for scripting in FiveM.

- **[Scripting Reference](/docs/developers/scripting-reference)**
A complete reference guide for available functions, events, and more.

<!-- - [Coding guidelines](/docs/developers/coding-guidelines) -->
<!-- - [Compiling FiveM](../../../../docs/developers/compiling-fivem) -->
32 changes: 32 additions & 0 deletions content/docs/developers/scripting-manual/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: Guides for scripting
weight: 400
layout: single
---

- [Scripting introduction](/docs/developers/scripting-manual/introduction)
- [Introduction to resources](/docs/developers/scripting-manual/introduction/introduction-to-resources)
- [Creating your first script](/docs/developers/scripting-manual/introduction/creating-your-first-script)
- [About native functions](/docs/developers/scripting-manual/introduction/about-native-functions)
- [Scripting runtimes](/docs/developers/scripting-manual/runtimes)
- [Scripting in Lua](/docs/developers/scripting-manual/runtimes/lua)
- [Scripting in JavaScript](/docs/developers/scripting-manual/runtimes/javascript)
- [Scripting in C#](/docs/developers/scripting-manual/runtimes/csharp)
- [Migrating from deprecated methods](/docs/developers/scripting-manual/migrating-from-deprecated)
- [Chat Messages](/docs/developers/scripting-manual/migrating-from-deprecated/chat-messages)
- [Working with events](/docs/developers/scripting-manual/working-with-events)
- [Listening for events](/docs/developers/scripting-manual/working-with-events/listening-for-events)
- [Triggering events](/docs/developers/scripting-manual/working-with-events/triggering-events)
<!-- - [Using events](/docs/developers/scripting-manual/working-with-events/using-events) -->
<!-- - [Creating new events](/docs/developers/scripting-manual/working-with-event/creating-new-events) -->
<!-- - [Server-client communication](/docs/developers/scripting-manual/working-with-event/server-client-communication) -->
- [User interfaces with NUI](/docs/developers/scripting-manual/nui-development)
- [Fullscreen NUI](/docs/developers/scripting-manual/nui-development/full-screen-nui)
- [Direct-rendered UI (DUI)](/docs/developers/scripting-manual/nui-development/dui)
- [NUI callbacks](/docs/developers/scripting-manual/nui-development/nui-callbacks)
- [Loading screens](/docs/developers/scripting-manual/nui-development/loading-screens)
- [Using Scaleform](/docs/developers/scripting-manual/using-scaleform)
- [Voice](/docs/developers/scripting-manual/voice)
- [Using new game features](/docs/developers/scripting-manual/using-new-game-features)
- [Fuel consumption](/docs/developers/scripting-manual/using-new-game-features/fuel-consumption)
- [Collection-based natives](/docs/developers/scripting-manual/using-new-game-features/collection-based-natives)
11 changes: 11 additions & 0 deletions content/docs/developers/scripting-manual/introduction/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: Scripting introduction
weight: 410
layout: single
---

- [Introduction to resources](/docs/developers/scripting-manual/introduction/introduction-to-resources)
- [Creating your first script in Lua](/docs/developers/scripting-manual/introduction/creating-your-first-script)
- [Creating your first script in C#](/docs/developers/scripting-manual/introduction/creating-your-first-script-csharp)
- [Creating your first script in JavaScript](/docs/developers/scripting-manual/introduction/creating-your-first-script-javascript)
- [About native functions](/docs/developers/scripting-manual/introduction/about-native-functions)
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ AddTextEntry('CUSTOM_ENTRY', 'Hello, FiveM!')
-- Display the custom text entry when a player presses a specific key
Citizen.CreateThread(function()
while true do
Citizen.Wait(0) -- You can learn more about wait on https://docs.fivem.net/docs/scripting-reference/runtimes/lua/functions/Citizen.Wait
Citizen.Wait(0) -- You can learn more about wait on https://docs.fivem.net/docs/developers/scripting-reference/runtimes/lua/functions/Citizen.Wait
if IsControlJustReleased(0, 38) then -- Native that check if control E is released
BeginTextCommandDisplayHelp('CUSTOM_ENTRY') -- Display notification with another native
EndTextCommandDisplayHelp(0, false, true, -1)
Expand All @@ -80,7 +80,7 @@ end, false)
```

### Create Your First Resource
To learn how to create your first resource step-by-step, refer to the comprehensive guide in [this section](/content/docs/scripting-manual/introduction/creating-your-first-script.md). This guide will walk you through the process of setting up a new resource, writing your first script, and integrating it into your FiveM server.
To learn how to create your first resource step-by-step, refer to the comprehensive guide in [this section](/docs/developers/scripting-manual/introduction/creating-your-first-script). This guide will walk you through the process of setting up a new resource, writing your first script, and integrating it into your FiveM server.

### Commonly Used Native Functions
Here are some commonly used native functions and their descriptions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Getting started with scripting for FiveM might be a tad overwhelming, given the
Before creating your first script with C#, there are a couple of things you will need to set up and understand.

* [A basic understanding of C#](https://learn.microsoft.com/en-us/dotnet/csharp/#learn-to-program)
* [Creating a C# project and setup your environment](/docs/scripting-manual/runtimes/csharp)
* [Understanding of resources and manifest files](/docs/scripting-reference/resource-manifest/resource-manifest)
* [Creating a C# project and setup your environment](/docs/developers/scripting-manual/runtimes/csharp)
* [Understanding of resources and manifest files](/docs/developers/scripting-reference/resource-manifest/resource-manifest)

### Writing code
Now that you have set up your C# project and environment, you will have two projects; `MyResourceNameClient` and `MyResourceNameServer`.
Expand Down Expand Up @@ -71,7 +71,7 @@ You might be overwhelmed at this point, but don't worry. We will go through ever
```csharp
EventHandlers["onClientResourceStart"] += new Action<string>(OnClientResourceStart);
```
In the constructor we've added an event handler for the [onClientResourceStart](/docs/scripting-reference/events/list/onClientResourceStart/) event. It takes one argument; a string with the name of the resource that was started. It also has a delegate method `OnClientResourceStart`, which we defined beneath the constructor. Once the resource has started, FiveM will trigger this event and invoke the method.
In the constructor we've added an event handler for the [onClientResourceStart](/docs/developers/scripting-reference/events/list/onClientResourceStart/) event. It takes one argument; a string with the name of the resource that was started. It also has a delegate method `OnClientResourceStart`, which we defined beneath the constructor. Once the resource has started, FiveM will trigger this event and invoke the method.

```csharp
if (GetCurrentResourceName() != resourceName) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Before creating your first script with JavaScript, there are a couple of things

* [Understanding the JavaScript programming language (Getting Started)][basic-understanding-js]
* [Understanding the JavaScript runtime][runtime-javascript]
* [Understanding of resources and manifest files](/docs/scripting-reference/resource-manifest/resource-manifest)
* [Understanding of resources and manifest files](/docs/developers/scripting-reference/resource-manifest/resource-manifest)

We will be using Visual Studio Code, hereby VSCode, a popular code editor by Microsoft. However, you can use any code editor you'd like.

Expand Down Expand Up @@ -303,5 +303,5 @@ In your server console, `refresh; restart mymode` (yeah you can split stuff with
## Server scripts
You'll probably also want to write scripts that interact with the server. This section is still to be written. :-(

[runtime-javascript]: /docs/scripting-manual/runtimes/javascript/
[runtime-javascript]: /docs/developers/scripting-manual/runtimes/javascript/
[basic-understanding-js]: https://developer.mozilla.org/en-US/docs/Web/JavaScript
Original file line number Diff line number Diff line change
Expand Up @@ -284,4 +284,4 @@ In your server console, `refresh; restart mymode` (yeah you can split stuff with
You'll probably also want to write scripts that interact with the server. This section is still to be written. :-(


[manifest-reference]: /docs/scripting-reference/resource-manifest/resource-manifest/
[manifest-reference]: /docs/developers/scripting-reference/resource-manifest/resource-manifest/
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@ Here's a quick informative sheet to get you up to speed with FiveM development.
_ScRT_ means _Scripting Runtime_ or _Script Runtime_. FiveM has three different scripting runtimes available (Lua, C# and JavaScript), and they are mentioned down below.

# How do I get started with scripting?
The scripting manual can be found [here](/docs/scripting-manual/) and it features the following articles:

- [Introduction to resources](/docs/scripting-manual/introduction/introduction-to-resources)
- [Creating your first script](/docs/scripting-manual/introduction/creating-your-first-script)
- [Scripting runtimes](/docs/scripting-manual/runtimes)
- [Scripting in Lua](/docs/scripting-manual/runtimes/lua)
- [Scripting in JavaScript](/docs/scripting-manual/runtimes/javascript)
- [Scripting in C#](/docs/scripting-manual/runtimes/csharp)
- [Migrating from deprecated methods](/docs/scripting-manual/migrating-from-deprecated)
- [Chat Messages](/docs/scripting-manual/migrating-from-deprecated/chat-messages)
- [Working with events](/docs/scripting-manual/working-with-events)
- [Listening for events](/docs/scripting-manual/working-with-events/listening-for-events)
- [Triggering events](/docs/scripting-manual/working-with-events/triggering-events)
- [NUI](/docs/scripting-manual/nui-development)
- [Using Scaleform](/docs/scripting-manual/using-scaleform)
- [Voice](/docs/scripting-manual/voice)
- [Using new game features](/docs/scripting-manual/using-new-game-features)
The scripting manual can be found [here](/docs/developers/scripting-manual/) and it features the following articles:

- [Introduction to resources](/docs/developers/scripting-manual/introduction/introduction-to-resources)
- [Creating your first script](/docs/developers/scripting-manual/introduction/creating-your-first-script)
- [Scripting runtimes](/docs/developers/scripting-manual/runtimes)
- [Scripting in Lua](/docs/developers/scripting-manual/runtimes/lua)
- [Scripting in JavaScript](/docs/developers/scripting-manual/runtimes/javascript)
- [Scripting in C#](/docs/developers/scripting-manual/runtimes/csharp)
- [Migrating from deprecated methods](/docs/developers/scripting-manual/migrating-from-deprecated)
- [Chat Messages](/docs/developers/scripting-manual/migrating-from-deprecated/chat-messages)
- [Working with events](/docs/developers/scripting-manual/working-with-events)
- [Listening for events](/docs/developers/scripting-manual/working-with-events/listening-for-events)
- [Triggering events](/docs/developers/scripting-manual/working-with-events/triggering-events)
- [NUI](/docs/developers/scripting-manual/nui-development)
- [Using Scaleform](/docs/developers/scripting-manual/using-scaleform)
- [Voice](/docs/developers/scripting-manual/voice)
- [Using new game features](/docs/developers/scripting-manual/using-new-game-features)

You can refer to the page mentioned above to see the scripting manual in full detail.

Expand Down Expand Up @@ -53,7 +53,7 @@ These are named _Game references_, and they can be found over [here](/docs/game-
Hitch warnings indicate that one of your resources is not performing as it should and you should look into the affected resource to _figure out why, using the profiler can help diagnosing this._ Things such as these, can sometimes be caused by writing underperforming SQL queries that take a long time to execute, as well as unoptimized loops that end up halting the script execution.

## Profiler
The profiler can be used to diagnose _why_ a resource is taking a long time to execute, there's a [guide](/docs/scripting-manual/debugging/using-profiler) explaining how to use it, it can be used both on the server and client.
The profiler can be used to diagnose _why_ a resource is taking a long time to execute, there's a [guide](/docs/developers/scripting-manual/debugging/using-profiler) explaining how to use it, it can be used both on the server and client.

## Resource Monitor (Resmon)
The resource monitor can be used on the client to diagnose which resource is taking a long time to execute, it shows certain things such as cpu usage (msec) and memory usage for each resource.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,5 @@ these resources provide useful functionality to your server.

More information about the standard resources can be found in the [resource catalog][resource-catalog].

[manifest-reference]: /docs/scripting-reference/resource-manifest/resource-manifest/
[manifest-reference]: /docs/developers/scripting-reference/resource-manifest/resource-manifest/
[resource-catalog]: /docs/resources
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ weight: 430

In the past few years, FiveM has developed and advanced vastly. As a result of this, many tutorials and scripts have been left behind with methods and whatnot. This section will provide instructions on how to change from methods that have been deprecated.

- [Chat Messages](/docs/scripting-manual/migrating-from-deprecated/chat-messages)
- [Creating Commands](/docs/scripting-manual/migrating-from-deprecated/creating-commands)
- [Chat Messages](/docs/developers/scripting-manual/migrating-from-deprecated/chat-messages)
- [Creating Commands](/docs/developers/scripting-manual/migrating-from-deprecated/creating-commands)

Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ TriggerEvent("chat:addMessage", {
})
```

For further documentation of this event, see the [`chat:addMessage` section](../../../resources/chat/events/chat-addMessage).
For further documentation of this event, see the [`chat:addMessage` section](../../../../resources/chat/events/chat-addMessage).
13 changes: 13 additions & 0 deletions content/docs/developers/scripting-manual/nui-development/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: User interfaces with NUI
weight: 440
---

**NUI** (short for 'new UI') is the HTML-based user interface functionality in the CitizenFX framework. Currently using
the [Chromium Embedded Framework](https://github.com/chromiumembedded/cef), it offers an asynchronous, performant way of creating in-game UI using
web technologies (HTML/CSS/JS, including frameworks like React or Angular, and accelerated WebGL).

- [Fullscreen NUI](/docs/developers/scripting-manual/nui-development/full-screen-nui)
- [Direct-rendered UI (DUI)](/docs/developers/scripting-manual/nui-development/dui)
- [NUI callbacks](/docs/developers/scripting-manual/nui-development/nui-callbacks)
- [Loading screens](/docs/developers/scripting-manual/nui-development/loading-screens)
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,5 @@ window.addEventListener('message', (event) => {
```

[mdn-messages]: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage#The_dispatched_event
[send-nui-message]: /docs/scripting-reference/runtimes/lua/functions/SendNUIMessage
[resource-manifest]: /docs/scripting-reference/resource-manifest/resource-manifest
[send-nui-message]: /docs/developers/scripting-reference/runtimes/lua/functions/SendNUIMessage
[resource-manifest]: /docs/developers/scripting-reference/resource-manifest/resource-manifest
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,4 @@ window.addEventListener('message', (event) => {
- [initFunctionInvoked](./initFunctionInvoked)
- [endInitFunction](./endInitFunction)

[resource-manifest]: /docs/scripting-reference/resource-manifest/resource-manifest
[resource-manifest]: /docs/developers/scripting-reference/resource-manifest/resource-manifest
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,5 @@ fetch(`https://${GetParentResourceName()}/getItemInfo`, {
To prevent requests from stalling, you **have to** return the callback at all times - even if containing just an empty
object, or `{"ok":true}`, or similar.

[registernuicallback]: /docs/scripting-reference/runtimes/lua/functions/RegisterNUICallback/
[registernuicallback]: /docs/developers/scripting-reference/runtimes/lua/functions/RegisterNUICallback/
[workaround]: https://github.com/citizenfx/fivem/blob/d911ecf638337c7c61fc6728110c92d84a217156/data/shared/citizen/scripting/lua/scheduler.lua#L958
Loading