Fitting your server
Your own adapter
An adapter for your own framework, a reworked package or a renamed resource.
You need your own adapter when the studio does not know the resource that does something on your server: your own framework, an inventory forked from another one under a new name, your own notifications.
A new adapter
- Resources → What the project can do, in the What the project cannot do box, the Make an adapter for field. The list gives resources started in
server.cfgthat have no adapter. - Based on: an empty skeleton, or an adapter to start from. An inventory forked from ox_inventory starts from the ox_inventory adapter with the name changed.
- Make adapter. The studio creates
adapters/<resource>/in the project and opensserver.lua.
The empty skeleton lists every capability in comments, with the exports the resource has. You uncomment the ones the resource can do and write the call to its export in each.
The missing capabilities in What the project can do are grouped by area (Player, Inventory, Interface…). Clicking an area shows its capabilities and what disappears from the studio without them.
Files
adapters/my_notifications/
adapter.json
server.lua
client.lua
adapter.json says what the adapter covers:
{
"id": "my_notifications",
"label": "My notifications",
"resource": "my_notifications",
"contract": 2,
"priority": 50,
"server": [],
"client": ["ui.notify"]
}
resource: the adapter works only while this resource is started.server,client: the capabilities the adapter carries out on each side. The studio fills them in itself when you saveserver.luaandclient.lua: a capability uncommented in Lua goes on the list, a commented one comes off it.priority: when two adapters give the same thing, the lower number wins (unless you choose otherwise in What the project can do).unless: a resource that switches this adapter off when it is started.contract: the version of the capability list. An adapter written for a newer one than the studio knows is skipped with a warning.
client.lua carries out capabilities on the player’s side:
StudioAdapter('my_notifications', {
['ui.notify'] = function(text, kind)
exports.my_notifications:Show(text, kind)
end,
})
Capabilities about a player get the player’s number as the first argument on the server:
StudioAdapter('my_inventory', {
['inventory.add'] = function(src, item, count)
return exports.my_inventory:Give(src, item, count or 1)
end,
})
The arguments and result of every capability are in the comments of the empty skeleton.
Saving takes effect at once
Saving an adapter file loads it on the running server and checks its capabilities. The result shows in What the project can do, and the studio at once shows what the new capability enables (tools, mechanic steps).
Changing an adapter that comes with the studio
A studio adapter has Customize: a copy goes to adapters/<id>/ in the project and from then on wins over the studio’s version. Studio updates do not change it.
When a studio update brings a new version of one of its adapters, Restore with the previous version number appears next to it, in case the new one breaks something.
Claude
Claude does the same over MCP: adapter_new (with from to start from another adapter), adapter_customize, caps_check. It can read the resource’s exports, write the adapter and check it on the server.