Client
lib.marker
Simple way to create markers
Marker Class
A table representing a marker with the following properties.
- type:
number
orstring
- This field accepts either a numerical value representing the marker ID or a string containing the name of a marker as documented on FiveM Docs (opens in a new tab).
- coords?:
vector3
- width?:
number
- height?:
number
- color?:
{ r: number, g: number, b: number, a: number}
- direction?:
vector3
- rotation?:
vector3
lib.marker.new
lib.marker.new(options)
- Returns:
Marker
Usage Example
local marker = lib.marker.new({
type = 1,
coords = GetEntityCoords(cache.ped),
color = { r = 255, g = 0, b = 0, a = 200 },
})
Citizen.CreateThread(function()
while true do
marker:draw()
Citizen.Wait(1)
end
end)
Interactive Example
local center = vec3(430.452759, -1026.108032, 27.846140)
local uiText = "Press [E] to get notified"
local point = lib.points.new({
coords = center,
distance = 20,
})
local marker = lib.marker.new({
coords = center,
type = 1,
})
function point:nearby()
marker:draw()
if self.currentDistance < 1.5 then
if not lib.isTextUIOpen() then
lib.showTextUI("Press [E] to get notified")
end
if IsControlJustPressed(0, 51) then
lib.notify({
description = "Hello, World!"
})
end
else
local isOpen, currentText = lib.isTextUIOpen()
if isOpen and currentText == uiText then
lib.hideTextUI()
end
end
end