Map Editor Developer API
Exports
exports.rm_mapeditor:open()
exports.rm_mapeditor:close()
exports.rm_mapeditor:isOpen()
exports.rm_mapeditor:getObjects()
exports.rm_mapeditor:getMaps()
exports.rm_mapeditor:unstick()| Export | Returns | |
|---|---|---|
open() | nothing | Opens the editor — permission is still checked |
close() | nothing | Closes it |
isOpen() | boolean | Whether it is open |
getObjects() | table | The objects currently loaded |
getMaps() | table | The maps this client knows about |
unstick() | nothing | Resets the camera and interface focus |
All client-side. Exports are keyed on the folder name, so renaming rm_mapeditor breaks every call.
Guard them if the editor is optional on your server:
if GetResourceState('rm_mapeditor') == 'started' then
exports.rm_mapeditor:open()
endopen() is not a back door
It runs the same server-side permission check as /mapeditor. A player without the grant gets nothing, whichever route you use.
The open event
TriggerEvent('rm_mapeditor:openEditor')For a resource that would rather fire an event than depend on an export name. The name is configurable:
Config.OpenEvent = 'rm_mapeditor:openEditor'Do not reuse a name the resource already uses internally
It checks at start-up and prints a red console warning naming the clash. The editor will not open from a clashing name, so the warning is the only sign something is wrong.
A staff menu entry
-- my_admin/client.lua
RegisterNetEvent('my_admin:client:openMapEditor', function()
if exports.rm_mapeditor:isOpen() then
exports.rm_mapeditor:close()
else
exports.rm_mapeditor:open()
end
end)Checking isOpen() first makes the entry a toggle, which is usually what a menu wants.
Reading what is placed
local objects = exports.rm_mapeditor:getObjects()
local maps = exports.rm_mapeditor:getMaps()Both read the client's current state — what this player has loaded, not the whole database. A player standing in Valentine does not have the Blackwater objects.
For a server-side answer, query the tables.
The five tables
| Table | Holds |
|---|---|
rm_mapeditor_maps | Maps — name, description, permanent, expiry, enabled, centre, radius, object count, sort and outline order, who created and updated it |
rm_mapeditor_objects | Every placed object |
rm_mapeditor_removed | Game world props removed for everyone |
rm_mapeditor_unavailable | Models the server could not resolve |
rm_mapeditor_audit | The action trail |
They are ordinary tables and safe to read.
Writing to them directly needs a reload
The resource holds its maps in memory and does not poll. After writing, run rm_mapeditor_reload from the server console or the change is invisible to everyone until a restart.
Which maps are live and how big they are:
SELECT name, enabled, permanent, object_count, radius, updated_name, updated_at
FROM rm_mapeditor_maps
ORDER BY object_count DESC;Temporary maps about to expire:
SELECT name, expires_at, object_count
FROM rm_mapeditor_maps
WHERE permanent = 0 AND expires_at IS NOT NULL
ORDER BY expires_at;Models that could not be resolved — the table to check when an import looks emptier than the file suggested:
SELECT * FROM rm_mapeditor_unavailable;Custom props
Your own models appear in the catalogue once listed:
Config.CustomProps = {
{ model = 'my_prop', label = 'My Prop', category = 'Custom', sub = 'Buildings' },
}| Field | |
|---|---|
model | The model name as streamed |
label | What the catalogue shows |
category | Top-level grouping |
sub | Sub-grouping inside it |
Load order matters
Start the resource streaming the model before rm_mapeditor. A model that is not streamed yet cannot be previewed or placed, and lands in rm_mapeditor_unavailable.
Notifications
Config.Notify is a plain function you can replace to route the editor's messages into your own notification system:
function Config.Notify(message, kind, duration)
if IsDuplicityVersion() then
print(('[rm_mapeditor] [%s] %s'):format(kind or 'info', message))
return
end
TriggerEvent('my_notify:show', message, kind, duration or 4000)
endKeep the IsDuplicityVersion() branch — the server calls this too and has no interface to draw in.
Exported maps do not need the editor
A resource export is a standalone resource with its own streamer. Once exported, it runs on a server that has never heard of rm_mapeditor.
That is the intended deployment: build on a staging server with the editor, export, and ship only the resource to production. See Exporting.