Client Integration
Client-side exports and events for NZ Objective v1
This page covers client-side functionality for NZ Objective v1. These functions handle UI display and client-side state management.
Client Exports
| Export | Parameters | Returns | Description |
|---|---|---|---|
showObjective(data) | data: table | void | Displays an objective on the client UI |
hideObjective(id) | id: string | void | Hides an objective from the client UI |
updateObjectiveProgress(id, progress) | id: string, progress: number | void | Updates objective progress display |
Client Events
Receiving Events
| Event | Parameters | Description |
|---|---|---|
nz_objective:client:showObjective | data: table | Server requests to show an objective |
nz_objective:client:hideObjective | id: string | Server requests to hide an objective |
nz_objective:client:updateProgress | id: string, progress: number | Server updates objective progress |
Triggering Events
| Event | Parameters | Description |
|---|---|---|
nz_objective:server:objectiveCompleted | id: string | Notify server that objective was completed client-side |
Example Usage
-- Show an objective on client
exports['nz_objective']:showObjective({
id = 'collect_apples',
title = 'Collect 5 Apples',
description = 'Find and collect 5 apples in the forest.',
progress = 0,
required = 5
})
-- Update progress
exports['nz_objective']:updateObjectiveProgress('collect_apples', 3)
-- Hide objective
exports['nz_objective']:hideObjective('collect_apples')
-- Listen for server objective updates
RegisterNetEvent('nz_objective:client:showObjective', function(data)
-- Objective data received from server
exports['nz_objective']:showObjective(data)
end)Client-side functions handle UI display only. All objective logic and persistence should be managed server-side.