Skip to content

Map Editor Developer API ​

Exports ​

lua
exports.rm_mapeditor:open()
exports.rm_mapeditor:close()
exports.rm_mapeditor:isOpen()
exports.rm_mapeditor:getObjects()
exports.rm_mapeditor:getMaps()
exports.rm_mapeditor:unstick()
ExportReturns
open()nothingOpens the editor — permission is still checked
close()nothingCloses it
isOpen()booleanWhether it is open
getObjects()tableThe objects currently loaded
getMaps()tableThe maps this client knows about
unstick()nothingResets 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:

lua
if GetResourceState('rm_mapeditor') == 'started' then
    exports.rm_mapeditor:open()
end

open() 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 ​

lua
TriggerEvent('rm_mapeditor:openEditor')

For a resource that would rather fire an event than depend on an export name. The name is configurable:

lua
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 ​

lua
-- 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 ​

lua
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 ​

TableHolds
rm_mapeditor_mapsMaps — name, description, permanent, expiry, enabled, centre, radius, object count, sort and outline order, who created and updated it
rm_mapeditor_objectsEvery placed object
rm_mapeditor_removedGame world props removed for everyone
rm_mapeditor_unavailableModels the server could not resolve
rm_mapeditor_auditThe 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:

sql
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:

sql
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:

sql
SELECT * FROM rm_mapeditor_unavailable;

Custom props ​

Your own models appear in the catalogue once listed:

lua
Config.CustomProps = {
    { model = 'my_prop', label = 'My Prop', category = 'Custom', sub = 'Buildings' },
}
Field
modelThe model name as streamed
labelWhat the catalogue shows
categoryTop-level grouping
subSub-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:

lua
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)
end

Keep 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.

Documentation for RedMorrow. Scripts are licensed per server — redistribution is not permitted.