Skip to content

Exports & events ​

Resources normally use the vendored lib (Integrating a resource), which wraps these exports and stays safe when np_admin isn't running. Call the exports directly only from resources that require np_admin.

Server exports ​

lua
exports.np_admin:can(src, 'np_inventory.give')   --> true / false
Export Returns
flow(recOrList) boolean Record successful value moves; prefer optional npAdmin.flow. See Value tracing
flowRef(prefix?) string Deal reference; optional lib generates it locally even while np_admin is stopped
registerAssetHandler(unit, def) boolean Asset owner/revert/lock callbacks; prefer npAdmin.assetHandler for restart safety
can(src, node) boolean Resolved permission. Console and owners are always allowed
limit(src, key) number | nil Group limit (ban.max_duration, vehicle.spawn_per_min). nil = unlimited
isStaff(src) boolean Holds any np_admin.* node
isOnDuty(src) boolean Staff and on duty
getGroups(src) string[] Group names
getFlags(src) table Discord flags { queuePriority?, streamer? }
getPlayer(src) table | nil { src, identifier, name, identifiers, joined, firstSeen, playtime, watch, groups, staff, duty }
registerPermissions(resource, list) number Register nodes { node, label, category, description? }[]
registerSettings(resource, schema) overrides Register a settings schema, returns the stored overrides
getSettings(resource) overrides Stored overrides of a resource
log(category, entry) Write an audit entry { action?, message?, actor?, target?, data? }
registerAction(def) boolean Register a staff action
notifyStaff({ title, message, icon?, tint? }) Toast to every staff member on duty
getTheme() table Server theme { brand?, strength, material }, see Server theme
ban(target, { reason, duration, message? }) Ban | nil, err Ban an online id or an identifier. duration in seconds, 0 = permanent
unban(codeOrId, reason) Ban | nil, err Revoke by code (NB-XXXX) or id
isBanned(identifier) Ban | false Active ban of an identifier
addMember(identifier, group, { expires?, source? }) Add to a group
removeMember(identifier, group) Remove from a group

register* calls take the resource name from the invoking resource, so a resource can't register for another one.

Client exports ​

Export
can(node) From the player's cached rules. UI only
isStaff()
openPanel(view?) Open the panel, optionally on a view (players, reports, settings …)
openMenu() Open the quick menu (or the panel without np_menu)

Events ​

Event Side Payload
np_admin:ready server, client – Server: np_admin (re)started. Client: the first session arrived. The lib re-registers on it
np_admin:permissionsChanged server src A player's groups or rules changed
np_admin:settingsChanged server resource, { [key] = value } Saved setting changes for a resource (reset keys carry their default)

State ​

Key
Player(src).state.npAdminDuty true while on duty
Player(src).state.npAdminFlags Discord flags { queuePriority?, streamer? }
GlobalState['npcfg:<resource>'] Overrides of scope = 'shared' settings (never secrets)
GlobalState.npTheme Server theme { brand? = '#RRGGBB', strength, material }. The lib reads it as npAdmin.theme()
GlobalState.npAdminWeather, npAdminClock, npAdminBlackout World state set from the panel

Net events ​

These are np_admin's internal contract between server, client and NUI. Don't trigger them from other resources.

Event Direction
np_admin:rpc / np_admin:rpcResult client → server / server → client Request and answer of every panel, menu and key action
np_admin:session server → client The player's groups, rules, limits, duty and staff state
np_admin:push server → client Live updates for the panel (badges, feed, reports, settings, toasts)
np_admin:fx:* server → client Effects on a player: teleport, freeze, heal, revive, kill, spectate, vehicle
np_admin:notify, np_admin:announce, np_admin:staffchat, np_admin:open server → client Notifications, announcements, staff chat, open the panel
np_admin:report:create, np_admin:report:message client → server /report and /rr
np_admin:report:update server → client Claimed, replied, closed: to the reporter

Every RPC is rate-limited (Config.RateLimit), size-checked and validated on the server, then checked for staff, node and duty before its handler runs.

Database ​

Tables are created on start (copy in sql/np_admin.sql):

Table
np_admin_players Every player seen: identifiers, tokens, first / last seen, playtime, watchlist
np_admin_groups, np_admin_members, np_admin_player_perms Groups, memberships, per-player overrides
np_admin_settings, np_admin_setting_history Setting overrides and their history
np_admin_bans, np_admin_warns, np_admin_notes Moderation
np_admin_reports, np_admin_report_messages Reports
np_admin_logs Audit log
np_admin_discord Discord role mappings made in the panel