Lifecycle Events
One event name per lifecycle moment, regardless of which framework is running underneath. No more if framework == 'vorp' then ... else ... end blocks scattered through your resources.
OnPlayerLoaded(callback)server
Fires once a player finishes loading into the server.
| Param | Type | Description |
|---|---|---|
| callback | function(source) | Runs when the player loads in. |
internally listens to —
vorp_core event
'vorp_core:Server:OnPlayerSpawned'
rsg-core event
'RSGCore:Server:OnPlayerLoaded'
example
wc:OnPlayerLoaded(function(source)
print("Player loaded:", source)
end)
OnPlayerUnload(callback)server
Fires when a player logs out or returns to character select.
VORP gap. There's no confirmed dedicated server-side "player unload" event for VORP in the docs this lib was built against. On RSG this fires reliably via
RSGCore:Server:OnPlayerUnload; on VORP it currently registers but never fires, with a console warning on startup explaining why. Extend it in _custom/server.lua if your VORP build exposes a usable event.
OnJobUpdate(callback)server
Fires when a player's job changes.
| Param | Type | Description |
|---|---|---|
| callback | function(source, newJob, oldJob) | Runs on job change. |
example
wc:OnJobUpdate(function(source, newJob, oldJob)
wc:Notify(source, { title = "Job updated" })
end)