Client Sync
File: client/sync.lua
Real-time group state synchronization between server and client.
Responsibilities
- Receive group state updates from server
- Send NUI messages to update React UI
- Handle group lifecycle events (created, disbanded, joined, left)
- Sync member lists, tasks, cooldowns, invites
Events Listened
| Event | NUI Action | Description |
|---|---|---|
wtf_group:client:groupSync | groupSync | Full group state update |
wtf_group:client:groupDisbanded | groupDisbanded | Group disbanded |
wtf_group:client:inviteReceived | inviteReceived | Invite received |
wtf_group:client:inviteAccepted | inviteAccepted | Invite accepted |
wtf_group:client:inviteDenied | inviteDenied | Invite denied |
wtf_group:client:cooldownSet | cooldownSet | Cooldown activated |
wtf_group:client:cooldownResult | cooldownResult | Cooldown check result |
wtf_group:client:taskCreated | taskCreated | New task created |
wtf_group:client:taskActivated | taskActivated | Task started |
wtf_group:client:taskCompleted | taskCompleted | Task completed |
wtf_group:client:taskFailed | taskFailed | Task failed |
wtf_group:client:showInstruction | showInstruction | Show instruction panel |
wtf_group:client:hideInstruction | hideInstruction | Hide instruction panel |
wtf_group:client:repSync | repSync | Reputation update |
wtf_group:client:levelUp | levelUp | Group leveled up |
wtf_group:client:dashboardSync | dashboardSync | Dashboard data update |
wtf_group:client:gpsSync | gpsSync | GPS/blip sync |
wtf_group:client:gpsToggled | gpsToggled | GPS toggle state |
Helper Functions
lua
GroupNotify(title, desc, type, duration)
-- Sends both ox_lib notification AND in-UI toast
-- type: 'inform', 'success', 'error', 'warning'