Introduction to resources

Servers run on a collection of resources. A resource is a collection of files - such as client scripts, server scripts, and streaming assets - that can be started, stopped and restarted at any time.

Resource directories

In the server, resources are loaded from a folder called resources/ in the server data directory. Any folder in the resources/ folder is parsed as a resource, except folders between [brackets] which are categories, which can contain multiple resource folders.

Each resource folder also has to contain a resource manifest reference called __resource.lua to be correctly parsed as a resource.

See this example directory tree:

server
└── resources
    ├── [category]
    │   ├── [another]
    │   │   └── thing
    │   │       └── __resource.lua
    │   └── resource-1
    │       └── __resource.lua
    └── main
        └── __resource.lua

In this tree, the following resources exist:

The resource manifest

Every resource is required to contain a resource manifest by the name of __resource.lua defining what files/scripts are used by the resource. A quick example manifest 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"})

See the resource manifest reference for more details.

Standard resources

After you’ve installed your server, you’ll notice you already have quite a few resources. These are the standard resources that FiveM ships and maintains. It’s advised to not change them unless you know what you’re doing. Many of these resources provide useful functionality to your server.

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