Resource manifest

The resource manifest is a file named __resource.lua, placed in a resource folder on the server.

It is a Lua file, ran in a separate runtime from the usual Lua scripts, using a special setup so that a semi-declarative syntax can be used for defining metadata.

Example

An example resource manifest for a hypothetical resource looks as follows:

resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937'

client_scripts {
    'client.lua',
    'client_two.lua'
}

server_script 'server.lua'

-- extra data can be used as well
my_data 'one' { two = 42 }
my_data 'three' { four = 69 }

-- due to Lua syntax, the following works too:
my_data('nine')({ninety = "nein"})

Internally, this creates the following metadata entries:

Resource manifest entries

A list of built-in resource manifest entries follows. A resource can also contain custom metadata entries, which can be obtained using GetNumResourceMetadata and GetResourceMetadata.

resource_manifest_version

Defines the supported functionality for the resource. This has to be one of a specific set of GUIDs. Each GUID inherits properties from the previous one. The current resource manifest version is 44febabe-d386-4d18-afbe-5e627f4af937.

client_script

Defines a script to be loaded on the client, and implicitly adds the file to the resource packfile. The extension determines which script loader will handle the file:

Extension File handler Meaning
.lua citizen:scripting:lua Lua source code
.net.dll citizen:scripting:mono .NET assembly referencing CitizenFX.Core
.js citizen:scripting:v8 JavaScript source code (client only)

server_script

Defines a script to be loaded on the server. The extension determines which script loader will handle the file, as with client_script.

export

Defines a global function to be exported by a client script. In Lua, this will export _G[exportName] as exportName. In C#, this’ll do absolutely nothing at this time.

Defining an export

Lua
exports {
    'setWidget',
    'getWidget'
}
local lastWidget

function setWidget(widget)
    lastWidget = widget
end

function getWidget()
    return lastWidget
end

Consuming an export

Lua
exports.myresource:setWidget(50)
C#
int widget = Exports["myresource"].getWidget();

server_export

Defines a global function to be exported by a server script.

ui_page

Sets the resource’s NUI page to the defined file. This file (along with its dependencies) has to be referenced using files.

ui_page 'html/index.html'
file 'html/index.html'

before_level_meta

Loads the specified level meta in the resource before the primary level meta.

after_level_meta

Loads the specified level meta in the resource after the primary level meta.

replace_level_meta

Replaces the level meta (usually common:/data/levels/gta5/gta5.meta) with the specified file in the resource. This has to be referenced using files.

replace_level_meta 'mymap'
files {
    'mymap.meta'
}

data_file

Adds a data file of a specified type to the game extra content system.

files {
    'audio/mywaves/stupidcar.awc',
    'myvehicles.meta'
}

data_file 'AUDIO_WAVEPACK' 'audio/mywaves'
data_file 'VEHICLE_METADATA_FILE' 'myvehicles.meta'

this_is_a_map

Marks this resource as being a GTA map, and reloads the map storage when the resource gets loaded.

this_is_a_map 'yes' -- can be any value

server_only

Marks the resource as being server-only. This stops clients from downloading anything of this resource.

server_only 'yes' -- can be any value

loadscreen

Sets the HTML file specified as the game loading screen.

loadscreen 'html/loadscreen.html'
file 'html/loadscreen.html'

file

Adds the specified file to the resource packfile, to be downloaded by clients upon loading the resource.

file 'main.net.dll.mdb'

dependency

Requires the specified resource to load before the current resource.

dependency 'myresource-base'

dependencies

Alias for dependency. This is not a typo, but rather an intentional alias specifically for pluralization.

dependencies {
    'myresource-base',
    'utility-resource'
}

disable_lazy_natives

Lazy loading of natives currently only happens in Lua.

By default, lazy loading of native functions is enabled to drastically reduce resource memory usage. While not recommended, you can set this option to any value to disable lazy loading.

disable_lazy_natives 'yes'

Manifest versions

The resource manifest has to specify a particular version for the resource to adhere to. A list of version GUIDs and features they are associated with is shown on this page.

Each manifest version includes all features from manifest versions above, except where they would overrule one another, in which case the latest version is used.

No manifest version

By default, no manifest version is used, which is equivalent to manifest GUID 00000000-0000-0000-0000-000000000000. This (along with the empty GUID) will be removed in future releases of FXServer, and resources will be required to specify a manifest version.

Manifest version 00000000-0000-0000-0000-000000000000 (no date)

Manifest version 77731fab-63ca-442c-a67b-abc70f28dfa5 (2016-12)

Manifest version f15e72ec-3972-4fe4-9c7d-afc5394ae207 (2017-04-08)

Manifest version 44febabe-d386-4d18-afbe-5e627f4af937 (2017-06-07)

Manifest version 05cfa83c-a124-4cfa-a768-c24a5811d8f9 (2017-06-04)