Events and handlers
Server events
Events and handlers for REC_Core, with configuration and implementation details.
- Added
- Updated
REC_Core emits local events for other resources on the same side.
Event names use the resource name as a prefix, followed by server or client and the event key.
The examples below assume the resource is named REC_Core.
| Event | Arguments | Payload |
|---|---|---|
REC_Core:server:onPlayerLoaded | playerId, payload | citizenId, character |
REC_Core:server:onPlayerUnloaded | playerId, payload | citizenId, reason |
REC_Core:server:onCharacterCreated | playerId, payload | citizenId, character |
REC_Core:server:onCharacterDeleted | playerId, payload | citizenId |
REC_Core:server:onMoneyChange | playerId, payload | citizenId, account, action, amount, delta, balance, reason, resource |
REC_Core:server:onOfflineMoneyChange | payload | citizenId, account, action, amount, delta, balance, reason, resource |
REC_Core:server:onJobUpdate | playerId, payload | citizenId, job, oldJob |
REC_Core:server:onGangUpdate | playerId, payload | citizenId, gang, oldGang |
REC_Core:server:onDutyChange | playerId, payload | citizenId, onDuty, job |
REC_Core:server:onCharinfoChange | playerId, payload | citizenId, key, oldValue, newValue, charinfo |
REC_Core:server:onMetadataChange | playerId, payload | citizenId, key, oldValue, newValue |
REC_Core:server:onValueChange | playerId, payload | citizenId, namespace, dataKey, oldValue, newValue |
AddEventHandler("REC_Core:server:onMoneyChange", function (playerId, payload)
if payload.delta == 0 then
return
end
print(("^5[REC_Core] citizenId: %s, account: %s, delta: %d^0"):format(payload.citizenId, payload.account, payload.delta))
end)
amount is the amount passed to the operation; for setMoney it is the new balance.
delta is always the new balance minus the old one.
Unload reasons are logout, disconnect, or stop.
Offline money changes have no connection ID argument.
A duty change emits the server onDutyChange event; it is synchronized as a job update on the client.
