Setting up a resource manifest is essential for every FiveM resource, including maps, scripts, and other content types. The fxmanifest.lua
file serves as the configuration file for your resource, specifying metadata, files to be loaded, and scripts that should run on the client or server side. This guide will help you transition from the older __ressource.lua
setup to the more modern and flexible fxmanifest.lua
system, which is now the standard for FiveM resources.
Table des matières
What is fxmanifest.lua
?
fxmanifest.lua
is the configuration file for FiveM resources. It provides information about the resource, specifies which scripts to load, and defines various settings required for the resource to function correctly in a FiveM server. The manifest replaces the older __ressource.lua
file with a more structured approach, offering better organization and flexibility.
Why Use fxmanifest.lua
?
Le fxmanifest.lua
system offers several advantages over __ressource.lua
:
- Better Structure:
fxmanifest.lua
is more organized and allows you to use different metadata fields. - Compatibilité: It supports new game builds and includes backward compatibility options.
- Flexibility: You can define additional data and custom metadata fields.
Basic Structure of fxmanifest.lua
Before diving into the setup, let’s understand the basic structure of an fxmanifest.lua
file. Below is a typical example:
-- Resource Metadata
fx_version 'céruléen'
games { 'gta5' }
author 'Your Name <[email protected]>' -- optional
description 'A brief description of your resource' -- optional
version '1.0.0' -- optional
-- What to run
client_scripts {
'client.lua'
}
server_scripts {
'server.lua'
}
-- Additional data
files {
'data/file1.dat',
'data/file2.dat'
}
data_file 'DLC_ITYP_REQUEST' 'stream/resource_name.ytyp'
Breakdown of the Sections
- Resource Metadata: This section defines the basic information about your resource, such as the FX version and supported games.
- Scripts: Specifies which scripts should run on the client or server.
- Additional Data: Optional section for specifying additional files or data files.
Let’s explore each component in detail.
Step-by-Step Guide to Setting Up fxmanifest.lua
Follow these steps to create an fxmanifest.lua
file for your FiveM resource:
Step 1: Define the FX Version
The first line of your fxmanifest.lua
should define the FX version. This is required and specifies which version of the FiveM framework your resource is targeting. Currently, the most common versions are:
- bodacious
- azuré
- adamant
Use the following line to define your FX version:
fx_version 'céruléen'
Step 2: Specify the Supported Games
Le games
section specifies which games your resource supports. Typically, this will be:
- gta5 for Grand Theft Auto V
- rdr3 for Red Dead Redemption 2
You can specify multiple games if needed:
games { 'gta5' }
Step 3: Add Resource Metadata (Optional)
Although optional, adding metadata like the author, description, and version is a good practice as it helps other developers understand what your resource is about. Here’s how you can add metadata:
author 'Your Name <[email protected]>'
description 'A brief description of your resource'
version '1.0.0'
Step 4: Set Up the Scripts
Client Scripts
Define the scripts that should run on the client’s side. Use client_scripts
to list these:
client_scripts {
'client.lua',
'client_additional.lua' -- Add more scripts if necessary
}
Server Scripts
Define the scripts that should run on the server side. Use server_scripts
to list these:
server_scripts {
'server.lua',
'server_helper.lua' -- Additional server-side scripts
}
Step 5: Add Files to the Resource
If your resource includes additional files such as images, data files, or audio files, specify them using the fichiers
section:
files {
'html/ui.html',
'html/style.css',
'html/script.js'
}
Step 6: Use Data Files
Certain resources require data files for loading map assets, animations, or other custom data. Use the data_file
directive to specify these:
data_file 'DLC_ITYP_REQUEST' 'stream/resource_name.ytyp'
Step 7: Specify Additional Metadata (Optional)
You can add custom metadata fields to store extra information about your resource. These fields can be named arbitrarily, and you can add as many as you like:
my_custom_data 'some_value'
another_custom_field 'another_value'
Special Cases and Additional Options
Setting Up Maps in fxmanifest.lua
For maps, it’s essential to specify that the resource is indeed a map. Use the this_is_a_map
directive:
ceci_est_une_carte 'oui'
Using Multiple Game Versions
If your resource needs to support multiple games (e.g., GTA V and Red Dead Redemption 2), specify them in the games
section:
games { 'gta5', 'rdr3' }
Setting Dependencies
If your resource depends on other resources, you can specify these dependencies using the dépendances
field:
dependencies {
'essentialmode',
'another_required_resource'
}
Complete Example of fxmanifest.lua
Here is a complete example of an fxmanifest.lua
file that includes all the aspects we discussed:
-- Resource Metadata
fx_version 'céruléen'
games { 'gta5' }
author 'Your Name <[email protected]>'
description 'Example resource for a custom script'
version '1.0.0'
-- Resource Settings
ceci_est_une_carte 'oui'
-- Client and Server Scripts
client_scripts {
'client/main.lua',
'client/helper.lua'
}
server_scripts {
'server/main.lua',
'server/database.lua'
}
-- UI Assets and Additional Files
files {
'html/ui.html',
'html/style.css',
'html/script.js',
'audio/soundtrack.mp3'
}
-- Data Files for Custom Map Assets
data_file 'DLC_ITYP_REQUEST' 'stream/my_custom_map.ytyp'
-- Custom Metadata Fields
custom_info 'Extra info about the resource'
random_setting 'random_value'
-- Dependency Resources
dependencies {
'essentialmode',
'mysql-async'
}
Troubleshooting Common Issues
Issue 1: Resource Not Loading
- Check the FX Version: Make sure the
version_fx
is specified correctly and matches a valid version. - Ensure Proper File Paths: Double-check that all paths in the
client_scripts
,server_scripts
, etfichiers
sections are accurate.
Issue 2: Custom Data Not Working
- Ensure Correct Syntax: Verify that custom metadata fields and data files are set up using the correct syntax. For example, make sure you are using curly braces
{}
where necessary.
Issue 3: Map Not Loading
- Set
this_is_a_map
Properly: Make sure you have includedceci_est_une_carte 'oui'
in yourfxmanifest.lua
. - Use Correct Data Files: If you are loading custom map assets, ensure that the
data_file
directives are set up accurately.
Conclusion
Setting up fxmanifest.lua
is a straightforward yet crucial step in creating and running resources for a FiveM server. By following the structure and recommendations outlined in this guide, you can ensure that your resources are well-organized, flexible, and compatible with the latest FiveM updates. Make sure to test your setup after making changes and double-check for any errors to keep everything running smoothly.
With the tips and examples provided, you should now be equipped to create or convert an fxmanifest.lua
file for any FiveM resource with ease.