Modules
Marker
Client

Cliente

lib.marker

Método simples para criar marcadores.

Classe Marker

Uma tabela que representa um marcador com as seguintes propriedades.

  • type: number ou string
  • Este campo aceita um valor numérico representando o ID do marcador ou uma string contendo o nome do marcador conforme documentado na 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

Exemplo de Uso

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)

Exemplo Interativo

 
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