areTrafficLightsLocked | Multi Theft Auto: Wiki Skip to content

areTrafficLightsLocked

Client-side
Server-side
Shared

Manual Review Required

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


Gets whether the traffic lights are currently locked or not. If the lights are locked, it means they won't change unless you do setTrafficLightState.

Syntax

bool areTrafficLightsLocked ( )

Returns

  • bool: value

Returns true the traffic lights are currently locked, false otherwise.

Code Examples

shared

This example toggles traffic lights between 'locked' and 'unlocked'.

function toggleTrafficLights()
if areTrafficLightsLocked() then -- See if traffic lights are currently locked
setTrafficLightsLocked(false) -- unlock traffic lights if they are currently locked
else
setTrafficLightsLocked(true) -- lock traffic lights if they are not
end
end
-- add command for toggling traffic lights
addCommandHandler("toggletrafficlights",toggleTrafficLights)

See Also

World Functions