Server Integration
Server-side exports and events for UI Marker v1
This page covers server-side functionality for UI Marker v1. These functions handle synchronized markers and server-managed zones.
Server Exports
| Export | Parameters | Returns | Description |
|---|---|---|---|
createGlobalMarker(data) | data: table | string | Creates a marker visible to all players |
removeGlobalMarker(id) | id: string | boolean | Removes a global marker |
createPlayerMarker(playerId, data) | playerId: number, data: table | string | Creates a marker for a specific player |
removePlayerMarker(playerId, id) | playerId: number, id: string | boolean | Removes a player-specific marker |
updateGlobalMarker(id, data) | id: string, data: table | boolean | Updates a global marker |
Server Events
Receiving 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 |
Triggering Events
| Event | Parameters | Description |
|---|---|---|
uimarker:client:addMarker | data: table | Send marker to client for display |
uimarker:client:removeMarker | id: string | Remove marker from client |
uimarker:client:showZone | data: table | Show zone on client |
Parameter Details
createGlobalMarker / createPlayerMarker
data: table with the following fields:id:string— Unique marker ID (auto-generated if not provided)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)persistent:boolean— Whether marker persists across restarts (optional)permission:string— Required permission to see marker (optional)
Example Usage
-- Create a global shop marker
local shopMarkerId = exports['uimarker']:createGlobalMarker({
id = 'shop_downtown',
type = 'cylinder',
coords = vector3(250.0, 220.0, 100.0),
color = { r = 0, g = 255, b = 0, a = 200 },
size = { x = 3.0, y = 3.0, z = 2.0 },
label = 'Downtown Shop',
persistent = true
})
-- Create a player-specific marker
local playerMarkerId = exports['uimarker']:createPlayerMarker(1, {
type = 'arrow',
coords = vector3(300.0, 300.0, 100.0),
color = { r = 255, g = 255, b = 0, a = 255 },
size = { x = 1.0, y = 1.0, z = 1.0 },
label = 'Your Objective'
})
-- Update global marker
exports['uimarker']:updateGlobalMarker(shopMarkerId, {
label = 'Downtown Shop - 50% Off!'
})
-- Listen for marker interactions
RegisterNetEvent('uimarker:server:markerEntered', function(markerId)
local playerId = source
print('Player', playerId, 'entered marker:', markerId)
if markerId == 'shop_downtown' then
-- Handle shop interaction
TriggerClientEvent('shop:openMenu', playerId)
end
end)
RegisterNetEvent('uimarker:server:zoneInteraction', function(zoneId, action)
local playerId = source
print('Player', playerId, 'interacted with zone:', zoneId, 'action:', action)
if action == 'enter' then
-- Handle zone entry
elseif action == 'interact' then
-- Handle zone interaction (E key press)
end
end)
-- Remove markers
exports['uimarker']:removeGlobalMarker(shopMarkerId)
exports['uimarker']:removePlayerMarker(1, playerMarkerId)Validate player permissions and positions before creating or updating markers to prevent abuse.