NightZoom LogoNightZoom

Client Integration

Client-side exports and events for UI Marker v1

This page covers client-side functionality for UI Marker v1. These functions handle marker rendering, zones, and player interactions.

Client Exports

ExportParametersReturnsDescription
addMarker(data)data: tablestringAdds a new marker. Returns marker ID
removeMarker(id)id: stringbooleanRemoves a marker by ID
showZone(data)data: tablestringShows a UI zone. Returns zone ID
hideZone(id)id: stringbooleanHides a UI zone by ID
updateMarker(id, data)id: string, data: tablebooleanUpdates an existing marker
isPlayerInZone(id)id: stringbooleanChecks if player is in a specific zone

Client Events

Receiving Events

EventParametersDescription
uimarker:client:addMarkerdata: tableServer requests to add a marker
uimarker:client:removeMarkerid: stringServer requests to remove a marker
uimarker:client:showZonedata: tableServer requests to show a zone

Triggering Events

EventParametersDescription
uimarker:server:markerEnteredmarkerId: stringPlayer entered a marker area
uimarker:server:markerExitedmarkerId: stringPlayer exited a marker area
uimarker:server:zoneInteractionzoneId: string, action: stringPlayer interacted with a zone

Parameter Details

addMarker / showZone

  • data: table with the following fields:
    • type: string — Marker type ('cylinder', 'arrow', 'zone', 'blip')
    • coords: vector3 — World coordinates
    • color: table{ r, g, b, a } (0-255)
    • size: table{ x, y, z } (marker size)
    • label: string — Display label (optional)
    • onEnter: function — Callback when player enters (optional)
    • onExit: function — Callback when player exits (optional)
    • persistent: boolean — Whether marker persists across sessions (optional)

Example Usage

-- Add a simple cylinder marker
local markerId = exports['uimarker']:addMarker({
    type = 'cylinder',
    coords = vector3(250.0, 220.0, 100.0),
    color = { r = 255, g = 0, b = 0, a = 200 },
    size = { x = 2.0, y = 2.0, z = 1.0 },
    label = 'Shop Entrance',
    onEnter = function()
        print('Player entered shop area')
    end,
    onExit = function()
        print('Player left shop area')
    end
})

-- Show an interactive zone
local zoneId = exports['uimarker']:showZone({
    type = 'zone',
    coords = vector3(300.0, 300.0, 100.0),
    size = { x = 10.0, y = 10.0, z = 5.0 },
    label = 'Press E to interact'
})

-- Update marker color
exports['uimarker']:updateMarker(markerId, {
    color = { r = 0, g = 255, b = 0, a = 200 }
})

-- Check if player is in zone
if exports['uimarker']:isPlayerInZone(zoneId) then
    print('Player is in the zone')
end

-- Listen for marker events
RegisterNetEvent('uimarker:server:markerEntered', function(markerId)
    print('Entered marker:', markerId)
end)

-- Remove marker
exports['uimarker']:removeMarker(markerId)

Client-side markers are rendered locally for performance. Use server-side exports for synchronized markers across all players.