M MY Multiplayer: Wiki
Side
Kind

getElementComponentVisible

Client

Tells whether a vehicle's or object's component is visible.

bool getElementComponentVisible(vehicle|object element, string component)

Parameters

NameTypeDescription
elementvehicle|objectThe vehicle or object.
componentstringThe component's name, as getElementComponents lists it.

Returns

true if it is visible. false if it is hidden or the component does not exist.

Example

bindKey("b", "down", function()
    local vehicle = getPedOccupiedVehicle(localPlayer)
    if vehicle then
        local visible = getElementComponentVisible(vehicle, "bonnet_dummy")
        setElementComponentVisible(vehicle, "bonnet_dummy", not visible)
    end
end)
Coming from MTAThe same as MTA's getVehicleComponentVisible, but it also works on objects.

See also