getElementLighting | Multi Theft Auto: Wiki Skip to content

getElementLighting

Client-side
Server-side
Shared

Pair: setElementLighting

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function returns the lighting value for the specified element. This can be a player, ped, vehicle, object, weapon.

OOP Syntax Help! I don't understand this!

  • Method:element:getLighting(...)
  • Variable: .lighting

Syntax

float getElementLighting ( element theElement )
Required Arguments
  • theElement: The element whose lighting you want to retrieve.

Returns

  • float: value

Returns a float (0.0-0.5; 0 = dark; 0.5 = light) indicating the element's lighting, or false if invalid arguments were passed. This function will fail if called right after element creation.

Code Examples

shared

This example displays lighting values of streamed in players.

addEventHandler("onClientRender", root, function()
for _, pl in ipairs(getElementsByType("player", root, true)) do
local sX, sY = getScreenFromWorldPosition(getElementPosition(pl))
if sX then
dxDrawText("Lighting: "..tostring(getElementLighting(pl)), sX, sY)
end
end
end)

See Also

Element Functions