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

Function

setElementHighlight

ClientElementsTrilogy Hub only

Tints an element's whole model with a glow colour for this player only: an NPC, a player (including your own character), a vehicle or an object. Called with false instead of a colour it removes the glow.

Syntax

bool setElementHighlight(element theElement, int r [, int g, int b, float strength = 1])

Arguments

theElementelement
A ped, player, vehicle or object.
rint
Red 0-255, or false to remove the glow.
gint, optional
Green 0-255.
bint, optional
Blue 0-255.
strengthfloat, optional = 1
Strength 0-10.

Returns

true on success.

Example

Highlighting NPCs closer than 10 m.

setTimer(function()
    local x, y, z = getElementPosition(localPlayer)
    for _, ped in ipairs(getElementsByType("ped", root, true)) do
        local px, py, pz = getElementPosition(ped)
        if getDistanceBetweenPoints3D(x, y, z, px, py, pz) < 10 then
            setElementHighlight(ped, 255, 200, 0, 1.5)
        else
            setElementHighlight(ped, false)
        end
    end
end, 250, 0)

Notes

It brightens the model's surface; it is not an outline. The colour is added to the lighting of the game's materials, so dark parts glow less.

At most 128 elements at once. The glow is removed when the element is destroyed and when the resource that set it stops. An element out of range gets it when it streams in.

See also