Skip to content

Events & commands ​

Server events ​

server

Local server events (AddEventHandler), fired with TriggerEvent after the server did the work:

Event Arguments Fired when
np_character:created src, cid A character was created (before the spawn picker)
np_character:loaded src, cid The spawn was chosen and the framework login is done
np_character:unloaded src, cid The playing character left: /logout, logout export, or the player dropped
np_character:deleted cid, purged purged = false: soft delete (player or staff). true: hard delete after the grace period or by staff
lua
AddEventHandler('np_character:loaded', function(src, cid)
  print(('player %d is now playing %s'):format(src, cid))
end)

AddEventHandler('np_character:deleted', function(cid, purged)
  if purged then MySQL.update('DELETE FROM my_resource_data WHERE citizenid = ?', { cid }) end
end)

Client events ​

client

Local client events (AddEventHandler):

Event Arguments Fired when
np_character:loaded character (CharacterSummary) The ped stands at the spawn and the arrival finished. Once per character
np_character:unloaded The character was unloaded (logout to select)
np_character:storeClosed kind, ok, appearance A store closed. kind is the Config.Store key, or 'custom' for a store opened with steps
lua
AddEventHandler('np_character:loaded', function(character)
  print('playing', character.firstname, character.lastname, character.job.label)
end)

Whatever the framework's own login fires on the server still fires. The client-side "player loaded" events that the stock multicharacter or spawn resource would send are not replayed in v0.1.0. See Bridges → Client side.

Server → client net events ​

These are internal (TriggerClientEvent from np_character to np_character). Listed so you know what they are; don't trigger them yourself.

Event Arguments Purpose
np_character:rpc id, result RPC answers
np_character:client:openSelect selectPayload After /logout
np_character:client:selectUpdate selectPayload A staff action changed the list of a player who is in select
np_character:client:openAdmin adminPayload /charadmin
np_character:client:openStore { kind, steps, price, title, appearance } openStore export
np_character:client:notify { type, title, message } Toast
np_character:client:loaded character, appearance After the framework login on spawn:choose
np_character:client:teleport { x, y, z, w } Staff "teleport to last location" (moves the staff member)
np_character:client:setAppearance appearance Staff "reset appearance" while the target is playing

Commands ​

Command Side Description
/logout server Back to the select screen. Saves playtime and position, logs out of the framework and fires np_character:unloaded. Only while playing. Name and switch: Config.Logout
/charadmin <id> server Staff panel for a player. <id> is a server id or a license:… / license2:… identifier (works for offline players). Needs the np_character.admin permission node (Permissions; command name: Config.Admin). From the server console it prints the character list instead

Staff panel ​

Staff panel

/charadmin <id> opens a red staff panel with every character of that license, deleted ones included, pending rename requests and backstories.

Action Effect
Restore Undoes a soft delete. Moves to the first free slot if its slot is taken
Force rename Applies the pending rename request (charged Config.Rename.cost on the next spawn, or right away if playing), or sets a staff-chosen name for free. Name rules apply
Reset appearance Replaces the appearance with the defaults of the character's gender. Applied live if the target is playing
Delete Soft-deletes; on a character that is already deleted, purges it right away. Not possible while the target plays that character
Teleport to last location Teleports the staff member to the character's last location and closes the panel
Set slots Per-license slot override, 1 … Config.Slots.max. The target gets a toast when it unlocks slots

If the target sits on the select screen, their list refreshes immediately. Every action is logged as admin_<action> with the staff member, the target license and the CID.

Logs ​

NpChar.log writes a debug line (with Config.Debug), forwards the entry to np_admin's audit log (category np_character) while np_admin runs and, when a webhook is set, posts a Discord embed with the player's name, server id and license. Events: created, loaded, unloaded, deleted, purged, store, rename_request and admin_<action>. Set the webhook with the np_character_webhook convar (Installation).