Resources and manifest
A resource's folder, recurso.lua or recurso.json, their fields and how it starts.
A resource is a folder in datos-servidor/recursos/<name>/. It is activated with asegura <name> (asegura = ensure) in servidor.cfg (or ensure, as in FiveM), or live with arrancar <name> (arrancar = start) in the server console.
recursos/mi-recurso/
recurso.lua manifest (or recurso.json)
servidor.lua runs on the server (or servidor.js)
cliente.lua sent to each player and runs in their game (or cliente.js)
ui/index.html its HTML/CSS/JS interface, on top of the game
Manifest in Lua
recurso.lua returns a table:
return {
version = "1.0.0",
autor = "Yo",
descripcion = "What it does",
depende = { "sixm-rp" }, -- start before this one
servidor = { "config.lua", "servidor.lua" },
cliente = { "cliente.lua" }, -- in this order, in the same Lua machine
ui = "ui/index.html", -- interface page (optional)
archivos = { "ui/*" }, -- more files for the client (folder/* = everything inside)
}
Manifest in JSON
The same in recurso.json. If both exist, recurso.lua wins.
{
"version": "1.0.0",
"depende": ["sixm-rp"],
"servidor": ["config.js", "servidor.js"],
"cliente": ["cliente.js"],
"ui": "ui/index.html",
"archivos": ["ui/*"]
}
Fields
| Field | What it is |
|---|---|
version, autor, descripcion | informational (version, author, description) |
depende | resources that must be running first; they are started automatically if they are not |
servidor | server files, in order. Accepts carpeta/* |
cliente | files sent to each player that run in their game, in order |
ui | the resource's interface page |
archivos | more files for the client (CSS, JS, images, fonts); carpeta/* = everything inside |
The language is determined by the extension: .lua or .js. A resource can have its server side in Lua and its client side in JS, or mix files of both on the same side (each language in its own machine).
Files that share a machine
Files on the same side and in the same language share a machine, in manifest order. This is how a resource's configuration is done: config.lua leaves a global table and servidor.lua uses it.
-- config.lua
Config = { precio = 25, distancia = 5.0 }
-- servidor.lua
print("precio: " .. Config.precio)
In JS, var Config = {...} in config.js (with var, not const, so the other files can see it).
A file can go on both sides (servidor = { "datos.lua", ... } and cliente = { "datos.lua", ... }): each side has its own copy.
Limits
- The client side (code, interface and files) is at most 8 MB per resource.
- A single script step cannot exceed 2 s (common API).
- No files, network,
requireorimport: each resource is a sealed sandbox.
Sharing it
Community resources live in SixM resources. To publish yours, upload its folder as a .zip from Upload a resource, with screenshots and a description.
Lifecycle
- The server starts the resources in
servidor.cfgin order (each one, its dependencies first). - On join, each player receives the client side of the running resources and starts it.
arrancar,pararandreiniciar(start, stop, restart) in the console (or in the panel) do the same live, on the server and on all players.- When a resource stops, the
recurso:para(nombre)event reaches everyone, and SixM deletes any peds and objects it had created.