---
name: "BIS_fnc_switchLamp"
type: function
status: ok
groups: ["Object Manipulation"]
arma3_since: "1.64"
locality: {"argument": null, "effect": "local", "server_exec": false}
source: https://community.bistudio.com/wiki/BIS_fnc_switchLamp
revid: 348593
updated: 2023-11-08T13:44:37Z
---

# BIS_fnc_switchLamp

*Function · Object Manipulation · Arma 3 v1.64*

Locality: effect **local**

## Description

Switch streetlamp on/off.

## Syntax

```sqf
[object, state] call BIS_fnc_switchLamp
```

**Parameters:**

- `object`: [Object](../topics/Object.md) - street Lamp
- `state`: [Boolean](../topics/Boolean.md) - true to turn lamp on, false to turn it off

**Returns:** [Nothing](../topics/Nothing.md)

## Examples

### Example 1

```sqf
// switches all lamps off in a radius of 200m
private _lampsIn200m = nearestObjects [player, ["Lamps_base_F", "PowerLines_base_F", "PowerLines_Small_base_F"], 200];
{ [_x, false] call BIS_fnc_switchLamp; } forEach _lampsIn200m;
```

### Example 2

```sqf
// simulates a damaged street light
aLamp spawn {
    params [
        ["_lamp", objNull, [objNull]]
    ];
    while { player distance _lamp < 200 } do
    {
        [_lamp, selectRandom [true, false]] call BIS_fnc_switchLamp;
        sleep 0.1 + random 0.5;
    };
};
```

## See also

[switchLight](../commands/switchLight.md)

<sub>Source: [BI Community Wiki — BIS fnc switchLamp](https://community.bistudio.com/wiki/BIS_fnc_switchLamp) (revision 348593).</sub>
