Skip to content

Reference

Commands ​

lua
RLX.RegisterCommand("pay", {
  help = "Give cash",
  permission = false,                 -- false: everyone; "my.right"; nil: "command.pay"
  console = false,
  params = {
    { name = "player", type = "player" },
    { name = "amount", type = "int" },
    { name = "reason", type = "text", optional = true },
  },
}, function(ctx, args)
  -- ctx = { source, player (xPlayer), raw, reply(text, kind) }
  ctx.reply("Paid " .. args.amount .. " $", "success")
end)

Types: player (id or me, loaded character), playerId, number, int, string, text (rest of the line), item, job, gang, account. The handler runs in a thread. Players type commands in the chat (/pay 3 100) or the F8 console (pay 3 100). In usage messages, parameter names are translated with the param_<name> keys of rlx/locales/<lang>.lua, and a built-in command without help uses the help_<name> key.

Client-side commands ​

A command that needs nothing from the server (open a menu, a window) is created on the client, with the same function. It works in the chat (/phone) and in the F8 console (phone):

lua
-- client
RLX.RegisterCommand("phone", { help = "Take out your phone" }, function(args, raw)
  OpenPhone()
end)

The chat first runs the client command if it exists, otherwise it sends the line to the server. Another chat than rlx_chat does the same with RLX.RunCommand(line) (returns false if it is not a client command). The chat suggestions list both (RLX.GetCommands()).

LS:MP's developer commands (/reload, /lua, /slua, /profiler…) live in the F8 console only: no script can run them. Typed in the chat, RLX says so instead of "unknown command". In F8, /lua runs on your client and /slua on the server: server functions (RLX.GetPlayerCoords, RLX.CreateInstance, RLX.AddDecal…) are tested with /slua @your_resource ....

/help [search] (also /commands) opens the list of the commands this player may run (server and client, with their usage and description); a command with a permission is only listed for those who hold it. The permission given to RLX.RegisterCommand is used for that.

Built-in commands (permission rlx.command.<name>) ​

Players, money, items/setjob, /setgang, /setjoboffline <citizenid> <job> [grade], /givemoney, /giveaccountmoney, /setaccountmoney, /giveitem, /removeitem, /clearinventory
Weapons, licenses, statuses/giveweapon <player> <weapon> [ammo], /clearweapons, /givelicense, /removelicense, /feed [player], /setstatus <player> <status> <value>
Health/revive [player], /heal [player], /kill [player]
Movement/tp <x> <y> <z>, /tpm, /goto, /bring, /coords, /freeze <player>
Vehicles/car <model>, /dv [radius] (no radius: the vehicle you are in or the closest one; with one: every empty vehicle around; a deleted owned vehicle is recovered at the impound), /fix, /givecar <player> <model>
Points/movepoint [id]: move an interaction point (and its blip) to where you stand, go to it, or put it back (kept)
Server/noclip (its own camera, glued to you: no lag when you turn back), `/weather <type
Everyone/help [search] (/commands), /logout, /duty, /job, /photo, /jobmenu

me means yourself: /giveitem me bread 5.