{"name":"lightIsOn","title":"lightIsOn","type":"command","url":"https://community.bistudio.com/wiki/lightIsOn","revid":369182,"updated":"2024-09-03T10:34:45Z","groups":["Lights"],"status":"ok","games":{"ofp":"1.04","ofpe":"1.00","arma1":"1.00","arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"ofp 1.04","arma3_since":"0.50","description":"Check if lampost is on (shining).\n\n> [!NOTE]\n> A lamp state is **local** to each client (see switchLight).\n\n> [!NOTE]\n> This command was originally designed to only work with CfgNonAIVehicles class \"StreetLamp\" only;\n> since Arma 3 v1.92 this command was extended to work with street lights.","syntaxes":[{"syntax":"lightIsOn lamppost","params":[{"name":"lamppost","type":"Object","type_expr":"Object"}],"returns":{"type":"String","type_expr":"String","description":"can be one of:\n- \"ON\" - light is on - \"OFF\" - light is off - \"AUTO\" - applicable only to the light of type \"StreetLamp\" and is only on during the night. - \"ERROR\" - if command fails","text":"String - can be one of:\n\n- **\"ON\"** - light is on\n- **\"OFF\"** - light is off\n- **\"AUTO\"** - applicable only to the light of type \"StreetLamp\" and is only on during the night.\n- **\"ERROR\"** - if command fails"},"form":"unary","right":{"text":"lamppost"}}],"examples":[{"code":["if (lightIsOn nearestObject [player, \"StreetLamp\"] == \"ON\") then { hint \"nightime\"; };"]},{"code":["_it = lightIsOn object 159582;"]},{"text":"```sqf\nif (count allMissionObjects \"StreetLamp\" == 0) then {\n    hint \"Objects compatible with 'lightIsOn' are not found.\";\n} else {\n    hint \"'lightIsOn' compatible objects are found!\";\n};\n```","code":["if (count allMissionObjects \"StreetLamp\" == 0) then {\n\thint \"Objects compatible with 'lightIsOn' are not found.\";\n} else {\n\thint \"'lightIsOn' compatible objects are found!\";\n};"]}],"see_also":["switchLight"]}