NightZoom LogoNightZoom

API Reference

Public exports and events for NZ Dialog v1 integration

Client Exports

Client-side functions for dialog display and interactions.

ExportParametersReturnsDescription
showDialog(data, cb)data: table, cb: functionvoidShows a dialog to the player with callback
closeDialog()nonevoidCloses the currently open dialog
isDialogOpen()nonebooleanReturns true if a dialog is currently open

Server Exports

Server-side functions for managing player dialogs.

ExportParametersReturnsDescription
showDialogToPlayer(playerId, data, cb)playerId: number, data: table, cb: functionvoidShows a dialog to a specific player
closeDialogForPlayer(playerId)playerId: numbervoidCloses dialog for a specific player
showDialogToAll(data, cb)data: table, cb: functionvoidShows a dialog to all players

System Overview

NZ Dialog provides a flexible dialog system for player interactions.

  • Client: Handles dialog display, user input, and local interactions
  • Server: Manages server-initiated dialogs and processes responses
  • Types: Supports confirmation, input, and selection dialogs

Dialog Types

  • confirm: Yes/No confirmation dialogs
  • input: Text input dialogs with validation
  • select: Multiple choice selection dialogs

For detailed integration examples, see the Client Integration and Server Integration pages.

Example Usage

-- Show a dialog to a player
exports['nz_dialog']:showDialog({
    title = 'Confirm Action',
    message = 'Are you sure you want to proceed?',
    buttons = {
        { label = 'Yes', value = true },
        { label = 'No', value = false }
    }
}, function(response)
    if response then
        print('Player confirmed!')
    else
        print('Player cancelled.')
    end
end)

-- Listen for dialog response
RegisterNetEvent('nz_dialog:client:dialogResponse', function(response)
    print('Dialog response:', response)
end)

For advanced use cases, contact the development team for guidance on safe integration.