Commands & key mappings
Chat commands, permissions, suggestions and key bindings.
Developer Preview. Scripting is live on Neighborly servers – everything on these pages works today. The API is young, so tell us what you need next on Discord.
Commands are typed in chat (/dice) or in the server console (dice). They are the quickest way to give players and admins new tools.
RegisterCommand
| Parameter | Description |
|---|---|
name | The command without the slash. Lowercase, no spaces. |
handler | function(source, args, raw) – source is the player id (0 for the console), args is a table of the words after the command, raw is the full text that was typed. |
restricted | When true, only players with the ACE permission command.<name> can use it. |
RegisterCommand('givecash', function(source, args, raw)
local target = tonumber(args[1])
local amount = tonumber(args[2])
if not target or not amount or not GetPlayerName(target) then
print('Usage: givecash <player id> <amount>')
return
end
GiveMoney(target, math.floor(amount), 'Admin gift')
print(('Gave %d to %s'):format(amount, GetPlayerName(target)))
end, true)Server commands can be used by players in chat and by the console. When a command can be run from the console, remember that source is 0 there and there is no Sim – check before you call natives that need one.
Client commands
Commands registered in a client script run only on that player's PC. They are great for UI toggles and anything local – source is always 0 and restricted is ignored, so never use client commands for admin actions.
RegisterCommand('hud', function()
SetHudVisible(not IsHudVisible())
end, false)Permissions (ACE)
Neighborly uses the same access control system as FiveM: principals (players, groups, resources) are granted aces (permission names). Restricted commands check for command.<name>; your own code can check any ace you invent.
| Principal | Who it is |
|---|---|
identifier.neighborly:4821 | One Neighborly account. Find the id with GetPlayerIdentifiers. |
player.12 | One connected player by server id, until they leave. |
group.admin | Every server admin. Players you op join this group automatically. |
group.<anything> | Your own groups, for example group.moderator or group.police. |
resource.<name> | A resource – used to allow ExecuteCommand and restricted natives. |
builtin.everyone | Every player. |
Grant permissions with console commands. To keep them after a restart, put the same lines into permissions in server.json:
> add_ace group.admin command allow
> add_ace group.moderator command.kick allow
> add_ace group.moderator rtx_cafe.manage allow
> add_principal identifier.neighborly:4821 group.moderator
> add_ace resource.rtx_jail command.jail allow
> remove_principal identifier.neighborly:4821 group.moderator
> list_aces{
"permissions": [
"add_ace group.moderator command.kick allow",
"add_ace group.moderator rtx_cafe.manage allow",
"add_principal identifier.neighborly:4821 group.moderator"
]
}add_ace group.admin command allow grants every command.* ace at once – aces are hierarchical. Use deny instead of allow to make an exception. Check permissions in your own code with IsPlayerAceAllowed:
RegisterNetEvent('rtx_cafe:setPrices', function(prices)
local src = source
if not IsPlayerAceAllowed(src, 'rtx_cafe.manage') then
return
end
GlobalState.cafePrices = prices
end)Chat suggestions
Suggestions show up under the chat box while typing, with help for each argument. Add them from a client script with the chat:addSuggestion event, or from the server for all players at once:
TriggerEvent('chat:addSuggestion', '/dice', 'Roll a die for everyone on your lot', {
{ name = 'sides', help = 'Number of sides, 2 to 100 (default 6)' }
})
TriggerEvent('chat:removeSuggestion', '/olddice')AddEventHandler('characterSelected', function()
TriggerClientEvent('chat:addSuggestion', source, '/report', 'Send a message to the admins', {
{ name = 'message', help = 'What happened?' }
})
end)Key mappings
RegisterKeyMapping binds a client command to a key. Players can change the key any time in the Neighborly menu → Settings → Key bindings → Resources, and their choice is remembered per server.
RegisterCommand('phone', function()
TriggerEvent('rtx_phone:toggle')
end, false)
RegisterKeyMapping('phone', 'Open the phone', 'keyboard', 'F10')For actions that last while a key is held, register two commands starting with + and - and map the + one. Neighborly runs +name on press and -name on release:
RegisterCommand('+radio', function()
TriggerServerEvent('rtx_radio:talking', true)
end, false)
RegisterCommand('-radio', function()
TriggerServerEvent('rtx_radio:talking', false)
end, false)
RegisterKeyMapping('+radio', 'Talk on the radio (hold)', 'keyboard', 'CAPITAL')| Device | Key names |
|---|---|
keyboard | A–Z, 0–9, F1–F12, SPACE, RETURN, TAB, CAPITAL, LSHIFT, LCONTROL, LMENU (Alt), INSERT, HOME, PAGEUP, DELETE, END, PAGEDOWN, UP, DOWN, LEFT, RIGHT, NUMPAD0–NUMPAD9 |
mouse | MOUSE_MIDDLE, MOUSE_EXTRABTN1, MOUSE_EXTRABTN2 |

F6–F9 and N are used by Neighborly itself, and many letters are Sims 4 shortcuts (build mode, camera). Pick something free like F10, F11 or Home as the default – players can always rebind it.