# QBCore client events

This list is verified against [`client/events.lua`](https://github.com/qbcore-fivem/qb-core/blob/9b3cddcce93e5e12cbcf6b47b866b687d32ac7bf/client/events.lua) and
[`server/player.lua`](https://github.com/qbcore-fivem/qb-core/blob/9b3cddcce93e5e12cbcf6b47b866b687d32ac7bf/server/player.lua).
QBCore resources can add their own events; an event from `qb-inventory` or another resource is not a
core event.

![Client event and trusted server state boundaries](/diagrams/authority.svg)

*Conceptual diagram; verify the behavior against your installed resource version.*

## Handlers registered in `client/events.lua`

These are the current net-event handlers in the core file itself. "Internal" means the event is a
framework transport/command path; it can still be observed, but new resources should prefer the
public function or lifecycle surface.

| Event | Handler arguments | Role |
| --- | --- | --- |
| `QBCore:Client:OnPlayerLoaded` | none | Lifecycle |
| `QBCore:Client:OnPlayerUnload` | none | Lifecycle |
| `QBCore:Client:PvpHasToggled` | `pvp_state` | Core state update |
| `QBCore:Command:TeleportToPlayer` | `coords` | Internal command transport |
| `QBCore:Command:TeleportToCoords` | `x, y, z, h` | Internal command transport |
| `QBCore:Command:GoToMarker` | none | Internal command transport |
| `QBCore:Command:SpawnVehicle` | `vehName` | Internal command transport |
| `QBCore:Command:DeleteVehicle` | none | Internal command transport |
| `QBCore:Client:VehicleInfo` | `info` | Vehicle/baseevents bridge |
| `QBCore:Client:OnPlayerUpdated` | `key, val` | Player-data synchronization |
| `QBCore:Notify` | `text, type, length, icon` | Notification transport |
| `QBCore:Client:TriggerClientCallback` | `name, ...` | Callback transport |
| `QBCore:Client:TriggerCallback` | `name, ...` | Callback transport |
| `QBCore:Command:ShowMe3D` | `senderId, msg` | `/me` display transport |
| `QBCore:Client:OnSharedUpdate` | `tableName, key, value` | Shared-data synchronization |
| `QBCore:Client:OnSharedUpdateMultiple` | `tableName, values` | Shared-data synchronization |
| `QBCore:Client:SharedUpdate` | `table` | Full shared-data synchronization |

The command-prefixed client events are destinations for already-authorized server command flows.
Triggering a client event locally is never a server-side permission grant.

## Events intended for resource integrations

| Event | Arguments | Meaning |
| --- | --- | --- |
| `QBCore:Client:OnPlayerLoaded` | none | Local player data finished loading. |
| `QBCore:Client:OnPlayerUnload` | none | Clear resource-local player state. |
| `QBCore:Player:SetPlayerData` | `playerData` | Full player data changed. |
| `QBCore:Client:OnJobUpdate` | `job` | Job data changed. |
| `QBCore:Client:OnGangUpdate` | `gang` | Gang data changed. |
| `QBCore:Client:SetDuty` | `onDuty` | Duty state changed. |
| `QBCore:Client:OnMoneyChange` | `moneyType, amount, operation, reason` | Money was added, removed, or set. |
| `QBCore:Client:EnteredVehicle` | `data` | Core vehicle state changed to entered. |
| `QBCore:Client:LeftVehicle` | `data` | Core vehicle state changed to left. |
| `QBCore:Client:UpdateObject` | none | Refresh the exported core object after shared-data changes. |

```lua
local QBCore = exports['qb-core']:GetCoreObject()

RegisterNetEvent('QBCore:Client:OnJobUpdate', function(job)
    local isPolice = job.name == 'police'
    -- Update only this resource's local state here.
end)

RegisterNetEvent('QBCore:Client:UpdateObject', function()
    QBCore = exports['qb-core']:GetCoreObject()
end)
```

## Internal transport events

`QBCore:Client:OnPlayerUpdated`, `QBCore:Client:VehicleInfo`, shared-data update events, and callback
transport events are framework internals. Prefer the integration events or public callback functions
instead of triggering internal events yourself.

There is no current core `QBCore:Client:OnUseItem` or `QBCore:Client:ItemBox` event. Item-box UI is
owned by the inventory resource used by the server.
