NightZoom LogoNightZoom

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

ExportParametersReturnsDescription
showObjective(data)data: tablevoidDisplays an objective on the client UI
hideObjective(id)id: stringvoidHides an objective from the client UI
updateObjectiveProgress(id, progress)id: string, progress: numbervoidUpdates objective progress display

Client Events

Receiving Events

EventParametersDescription
nz_objective:client:showObjectivedata: tableServer requests to show an objective
nz_objective:client:hideObjectiveid: stringServer requests to hide an objective
nz_objective:client:updateProgressid: string, progress: numberServer updates objective progress

Triggering Events

EventParametersDescription
nz_objective:server:objectiveCompletedid: stringNotify 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.