You first need a location for the light and it must obviously contain a light entity in it. Select the light entity and press ALT+ENTER. This will open a dialog box. Set the name as "light1".
Next create a small square brush that is against a wall (This will be the button). After placing the brush, select it and press CTRL+T and choose func_button.
Set these Properties:
Delay before reset: 0
Now go to the Outputs tab, click Add, and fill in the fields as shown below
My output named: OnPressed
Targets entities named: light
Via this input: Toggle
In the button properties, you can go to flags, and check of Damage Activates or Touch Activates, and this will allow you to shoot or just walk into the button to make it work.
And voila! That’s it.
Contributed by SiLenTDeaTH