SixM
Single player ↗

Client API

What runs inside the game: al_servidor, yo, jugadores, natives, peds and objects, keys and interface.

The client side is downloaded on join and runs in each player's game. In addition to the common API:

CallWhat it does
sixm.al_servidor(evento, ...)event to the server (the server must have declared it with sixm.red)
sixm.yo(){ id, x, y, z, rumbo, salud, en_vehiculo } or nil if you have not spawned yet
sixm.jugadores()the others: a list of { id, nombre, x, y, z, rumbo, ... }
nat.NAME(...)any game native by its name (Natives)
sixm.crear_peaton(modelo, {x,y,z}, rumbo, fn)creates a ped; fn(ent) once it exists (nil if the game does not create it)
sixm.crear_objeto(modelo, {x,y,z}, fn)the same, for an object
sixm.borrar(ent)deletes something this resource created
sixm.modelo_jugador()key of the player's model (GTA VI models are 64-bit keys)
sixm.peaton_cercano(x, y, z, radio)the ped closest to that point, as an entity, or nil (Lua only)
sixm.peaton_de(id)the ped another player is seen as, or nil
sixm.punto_aparicion()the aparicion point from servidor.cfg ({x, y, z, rumbo}) or nil
sixm.carga_fin()removes the server's loading screen
sixm.joaat(texto)hash of a name (controls, scenarios, weather...)
sixm.tecla(tecla, fn)fn() when the key is pressed with the game in front
sixm.ui.enviar(tipo, datos)sends data to the resource's page
sixm.ui.on(tipo, fn)what the page sends; "escape" arrives when the player presses Esc
sixm.ui.foco(true/false)the page receives mouse and keyboard, or gives them back to the game
sixm.salir()closes the game (used by the Esc menu)
sixm.idioma()the player's language: "en" or "es" (set by the launcher; "en" if missing). Lua and JS
sixm.aparecido()whether the player has already been placed at the aparicion point (used by aparecer)

Keys

sixm.tecla accepts "A"–"Z", "0"–"9", "F1"–"F24", "ENTER", "ESC", "ESPACIO", "TAB", "RETROCESO", "ARRIBA", "ABAJO", "IZQUIERDA", "DERECHA", "MAYUS", "CTRL", "ALT", "INICIO", "FIN" and "SUPR" (also in English: "SPACE", "UP", "SHIFT"...), or the Windows virtual-key code as a number.

It only fires with the game in front: while an interface has focus, the keyboard belongs to the interface. Esc with an interface open reaches it as "escape".

sixm.tecla("F5", function()
  local yo = sixm.yo()
  if yo then print(("estoy en %.1f %.1f %.1f"):format(yo.x, yo.y, yo.z)) end
end)

Peds and objects

sixm.crear_peaton(sixm.modelo_jugador(), { x = 10, y = 20, z = 5 }, 90.0, function(ped)
  if not ped then return print("el juego no lo creó") end
  nat.FREEZE_ENTITY_POSITION(ped, true)
  sixm.tras(30000, function() sixm.borrar(ped) end)
end)
  • Models are 64-bit keys; sixm.modelo_jugador() gives the player's. In the bundled resources, npcs places fixed peds and aspecto (appearance) stores each character's model.
  • sixm.borrar only deletes what this resource created. When the resource stops, SixM deletes whatever is left.
  • What you create exists only in your game. For everyone to see the same thing, the server sends the list to everyone (this is how npcs and tiendas do it).

Interface

sixm.tecla("K", function()
  sixm.ui.enviar("abrir", { titulo = "Hola" })
  sixm.ui.foco(true)
end)
sixm.ui.on("cerrar", function() sixm.ui.foco(false) end)
sixm.ui.on("escape", function() sixm.ui.enviar("cerrar"); sixm.ui.foco(false) end)

The page and its bridge are covered in HTML interfaces.

Client events of the bundled resources

EventWho listensWhat it does
sixm:aviso (texto, tipo)sixm-basenotice at the top right; type bien (good), error, info or dinero (money)
sixm.emitir("sixm:aviso", "Hecho", "bien")