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
| Export | Parameters | Returns | Description |
|---|---|---|---|
addMarker(data) | data: table | string | Adds a new marker. Returns marker ID |
removeMarker(id) | id: string | boolean | Removes a marker by ID |
showZone(data) | data: table | string | Shows a UI zone. Returns zone ID |
hideZone(id) | id: string | boolean | Hides a UI zone by ID |
updateMarker(id, data) | id: string, data: table | boolean | Updates an existing marker |
isPlayerInZone(id) | id: string | boolean | Checks if player is in a specific zone |
Client Events
Receiving Events
| Event | Parameters | Description |
|---|---|---|
uimarker:client:addMarker | data: table | Server requests to add a marker |
uimarker:client:removeMarker | id: string | Server requests to remove a marker |
uimarker:client:showZone | data: table | Server requests to show a zone |
Triggering Events
| Event | Parameters | Description |
|---|---|---|
uimarker:server:markerEntered | markerId: string | Player entered a marker area |
uimarker:server:markerExited | markerId: string | Player exited a marker area |
uimarker:server:zoneInteraction | zoneId: string, action: string | Player 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 coordinatescolor: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.