en-core announces almost everything it does through events, so your resources can react without polling. This page lists them all in one place. The pages for each system explain when and why they fire.
Naming:
encore:server:*events fire on the server. Listen withAddEventHandler.encore:client:*net events come from the server. Listen withRegisterNetEvent.- Some
encore:client:*events are local: en-core re-fires them on the client for convenience. Listen withAddEventHandler.
Server events
Fired by en-core on the server.
| Event | Payload | Page |
|---|---|---|
encore:server:onPlayerLoaded | source, playerData | Player API |
encore:server:onPlayerUnload | source, playerData (the player is already removed from the registry) | Player API |
encore:server:onJobUpdate | source, job | Jobs |
encore:server:onDutyUpdate | source, onduty | Jobs |
encore:server:onMoneyChange | source, moneyType, amount, action, reason, balance | Money and cash |
encore:server:onMoneySync | source, moneyType, balance | Money and cash |
encore:server:onSetMetaData | source, key, value | Player data |
encore:server:onRadiationChange | source, value, action, reason | Survival system |
encore:server:onInfectionChange | source, value, action, reason | Survival system |
encore:server:onImmunityChange | source, value, action, reason | Survival system |
encore:server:onTemperatureChange | source, temperature, 'set', reason | Survival system |
encore:server:onSurvivalTick | source, stats, damage, causes | Survival system |
encore:server:playerDied | source, killerServerId, cause | World and death |
encore:server:xpChanged | source, info | XP and levels |
encore:server:levelChanged | source, level, previousLevel | XP and levels |
encore:server:onGroupUpdate | source, summary or nil | Groups |
encore:server:groupCreated | groupId, source | Groups |
encore:server:groupJoined | groupId, source | Groups |
encore:server:groupLeft | groupId, source | Groups |
encore:server:groupInvite | targetSource, groupId, fromSource | Groups |
encore:server:groupDisbanded | groupId | Groups |
encore:content:ready | none | Content registry |
encore:content:changed | kind, id, data or nil | Content registry |
Notes:
- For radiation, infection and immunity,
valueis the resulting stat, not the amount changed.actionis'add','remove'or'set'(immunity has no'set'). - The per-stat survival events fire only from explicit calls such as
AddRadiation. The survival tick firesonSurvivalTickandonSetMetaDatainstead. - Player-object events can also fire when you change an offline player object. Don't rely on
sourcebeing a valid online player in that case.
Net events clients may send
en-core accepts these from clients. The server always uses the event's real source, never a player id from the payload.
| Event | Payload | What it does |
|---|---|---|
encore:server:requestLogout | none | Saves and logs the player out to character selection |
encore:server:toggleDuty | none | Toggles the sender's duty |
encore:server:syncHealth | health, armor | Stores health (clamped 0–200) and armour (0–100) |
encore:server:onPlayerDeath | killerServerId, cause | Marks the player dead |
encore:server:onPlayerLastStand | none | Marks the player in last stand |
encore:server:onPlayerRevive | none | Clears the dead and last stand flags |
Client net events
Sent by the server. Register them with RegisterNetEvent.
| Event | Payload |
|---|---|
encore:client:onPlayerLoaded | playerData |
encore:client:onPlayerUnload | none |
encore:client:playerDataUpdate | playerData |
encore:client:onJobUpdate | job |
encore:client:onDutyUpdate | onduty |
encore:client:onMoneyChange | moneyType, amount, action, reason, balance |
encore:client:onMoneySync | moneyType, balance |
encore:client:onSetMetaData | key, value |
encore:client:onRadiationChange | value, action, reason |
encore:client:onInfectionChange | value, action, reason |
encore:client:onImmunityChange | value, action, reason |
encore:client:onTemperatureChange | value, action, reason |
encore:client:survivalDamage | damage, causes (en-core applies the damage) |
encore:client:radiationExposure | rate |
encore:client:xpChanged | info |
encore:client:onGroupUpdate | summary or nil |
encore:client:groupInvite | { id, name, tag, from, timeout } |
encore:client:groupRosterChanged | groupId |
encore:client:contentChanged | kind, id, data or nil |
Client local events
Re-fired by en-core on the client. Listen with AddEventHandler.
| Event | Payload |
|---|---|
encore:client:playerLoaded | playerData |
encore:client:playerUnloaded | none |
encore:client:moneyChanged | moneyType, balance, action, reason (action is 'sync' for mirror updates) |
encore:client:groupChanged | summary or nil |
encore:client:playerDied | killerServerId, cause |
encore:client:playerRevived | none |
encore:client:survivalDamaged | damage, causes |
Callbacks
en-core registers these with the library's callback system. See Callbacks for how to call them.
| Callback | Arguments | Returns |
|---|---|---|
encore:groups:get | none | The player's group, pending invite and group rules |
encore:groups:action | action, data | { ok, result } or { ok = false, error } |
encore:content:get | kind | Every entry of that content kind |
Examples
A HUD that reacts to login, stat changes and money:
-- client
AddEventHandler('encore:client:playerLoaded', function(data)
-- build the HUD from data.metadata and data.money
end)
RegisterNetEvent('encore:client:onSetMetaData', function(key, value)
if key == 'radiation' then
-- update the radiation gauge
end
end)
AddEventHandler('encore:client:moneyChanged', function(moneyType, balance, action)
-- update the cash or bank display
end)Server-side setup when a character loads and cleanup when they leave:
AddEventHandler('encore:server:onPlayerLoaded', function(source, playerData)
print(('%s loaded as %s'):format(GetPlayerName(source), playerData.name))
end)
AddEventHandler('encore:server:onPlayerUnload', function(source, playerData)
-- clear anything you cached for this source
end)Watch every survival tick:
AddEventHandler('encore:server:onSurvivalTick', function(source, stats, damage, causes)
if damage > 0 then
print(source, damage, table.concat(causes, ', '))
end
end)