Runtime Mechanics Editor
Create and place mechanic locations in-game without touching config files. All changes are saved to the database and synced live.
Access
- Command:
/mechanics— configurable viaConfig.MechanicsEditor.command - Permission required: admin level — see Permissions
Features
- Freecam mode (F7) for precise placement
- Gizmo controls: move, rotate, and scale radius
- Step-by-step mechanic creation wizard
- Configure all features per mechanic: zone, blip, lift, craft, shop, boss, storage
- Shop & craft template system (reusable presets)
- Live runtime sync — changes apply immediately to all players
- Saved to
code9_mechanics_runtimedatabase table - Max 200 mechanic locations per server
- Mechanic auto-detection from player's current job
Permissions
/mechanics is admin-only. The check runs server-side and the allowed groups/permissions are configurable per framework via Config.MechanicsEditor.permissions.
Defaults
| Layer | Check | Default allowed |
|---|---|---|
| txAdmin / ACE | IsPlayerAceAllowed(src, ace) — runs for each txAdmin.aces entry | disabled by default |
| ESX | xPlayer.getGroup() — value compared against esxGroups list | admin, superadmin |
| QBCore | QBCore.Functions.HasPermission(src, perm) — runs for each qbPermissions entry | admin, god |
| QBox | QBX.Functions.HasPermission(src, perm) (fallback to exports.qbx_core:HasPermission) — runs for each qboxPermissions entry | admin, god |
The txAdmin / ACE layer runs before the framework check. If it allows access, the framework check is skipped — useful when your admins aren't tied to a framework group.
Customizing the lists
Edit shared/config.lua:
Config.MechanicsEditor.permissions = {
esxGroups = { 'admin', 'mod' },
qbPermissions = { 'admin', 'god', 'mod' },
qboxPermissions = { 'admin', 'god' },
txAdmin = {
enabled = true,
aces = { 'command' },
}
}
Granting access per player
txAdmin / ACE-based admins
For servers where admins are managed via txAdmin, vMenu, or any other ACE-based permission system (without using framework groups), enable the txAdmin block:
Config.MechanicsEditor.permissions.txAdmin = {
enabled = true,
aces = { 'command' }, -- or a custom ACE like 'code9.mechanic'
}
Each entry is checked with IsPlayerAceAllowed(source, ace). Any match grants access — independently of the framework groups below.
ESX
Player groups live in the users.group column. Set with the built-in admin command:
/setgroup [id] admin
QBCore
Permissions are FiveM ACE permissions. Grant in server.cfg:
add_principal identifier.license:xxxxxxxxxxxxxxxx qbcore.admin
Or at runtime:
QBCore.Functions.AddPermission(source, 'admin')
QBCore evaluates HasPermission against ACE entries prefixed with qbcore. (e.g. qbcore.admin, qbcore.god, qbcore.mod).
QBox
QBox uses ACE permissions. The standard pattern in server.cfg:
add_ace group.admin command allow
add_principal identifier.license:xxxxxxxxxxxxxxxx group.admin
Configuration
| Option | Default | Description |
|---|---|---|
enabled | true | Enable editor |
command | mechanics | Admin command name |
permissions | (object) | Allowed groups/permissions per framework + optional txAdmin/ACE layer — see Permissions |
freecamKeybind | F7 | Toggle freecam key |
liveSync | true | Immediate hot reload |
draft.maxMechanics | 200 | Maximum mechanic locations |
draft.maxNameLength | 30 | Max mechanic name length |
