ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Client functions
  3. isElementOnScreen

Function

isElementOnScreen

ClientElementsIdentical to MTA:SA

Checks whether an element is visible on the player's screen.

Syntax

bool isElementOnScreen(element theElement)

Arguments

theElementelement
The element.

Returns

true if on screen.

Example

addEventHandler("onClientRender", root, function()
    for _, veh in ipairs(getElementsByType("vehicle")) do
        if isElementOnScreen(veh) then
            local x, y, z = getElementPosition(veh)
            local sx, sy = getScreenFromWorldPosition(x, y, z + 1.5)
            if sx then dxDrawText(getVehicleName(veh), sx, sy) end
        end
    end
end)