{"name":"lightIsOn","operator":null,"title":"lightIsOn","type":"command","url":"https://community.bistudio.com/wiki/lightIsOn","revid":369182,"updated":"2024-09-03T10:34:45Z","groups":["Lights"],"status":"ok","replaced_by":[],"games":[{"game":"ofp","name":"Operation Flashpoint","version":"1.04"},{"game":"ofpe","name":"Operation Flashpoint: Elite","version":"1.00"},{"game":"arma1","name":"Armed Assault","version":"1.00"},{"game":"arma2","name":"Arma 2","version":"1.00"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"ofp","name":"Operation Flashpoint","version":"1.04"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"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","since":null,"effect":null,"exec":null,"params":[{"name":"lamppost","type":"Object","optional":false,"default":null,"description":null,"types":["Object"],"since":null,"text":"lamppost: Object"}],"returns":{"type":"String","types":["String"],"description":"can be one of: - \"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- **\"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","operator":null,"left":null,"right":{"text":"lamppost","types":["Object"]}}],"examples":[{"text":"```sqf\nif (lightIsOn nearestObject [player, \"StreetLamp\"] == \"ON\") then { hint \"nightime\"; };\n```","code":["if (lightIsOn nearestObject [player, \"StreetLamp\"] == \"ON\") then { hint \"nightime\"; };"]},{"text":"```sqf\n_it = lightIsOn object 159582;\n```","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};"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["switchLight"],"notes":[],"categories":["ArmA: Armed Assault: Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Lights","Introduced with Operation Flashpoint version 1.04","Operation Flashpoint: Elite: Scripting Commands","Operation Flashpoint: New Scripting Commands"]}