SixM
Single player ↗

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

FieldWhat it is
version, autor, descripcioninformational (version, author, description)
dependeresources that must be running first; they are started automatically if they are not
servidorserver files, in order. Accepts carpeta/*
clientefiles sent to each player that run in their game, in order
uithe resource's interface page
archivosmore 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, require or import: 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

  1. The server starts the resources in servidor.cfg in order (each one, its dependencies first).
  2. On join, each player receives the client side of the running resources and starts it.
  3. arrancar, parar and reiniciar (start, stop, restart) in the console (or in the panel) do the same live, on the server and on all players.
  4. When a resource stops, the recurso:para(nombre) event reaches everyone, and SixM deletes any peds and objects it had created.