The following are the two scripts that I tried they don't work. Your script also doesn't seem to work for me. I ever tried attaching the light to an entity and linking it to the player but I cannot turn the light on or off anyhow. Also, the old flashlight doesn't work with the shaders from BIMod. Hope someone can figure something out, as I am making the flashlight a bit integral to the level design.

:state=0:state=1
:state=1,keypressed=33 1:etimerstart,state=2,plrsound=audiobank\switches\click.wav
:state=1,keypressed=33 0:state=0
:state=2,etimergreater=150:state=3,flashlight=1
:state=3,keypressed=33 0:state=4,etimerstart,plrsound=audiobank\switches\click.wav
:state=3,keypressed=33 1:state=3
:state=4,etimergreater=50:state=0,flashlight=0

:state=0:uselightnumber=500
:state=0:setlighttoentityrot
:state=0:movelightred=255
:state=0:movelightgreen=102
:state=0:movelightblue=0
:state=0:movelightrange=150
:state=0:movelighttoentity
:state=0:state=1
:state=1,keypressed=33 1:etimerstart,state=2
:state=2,etimergreater=150:state=3,movelighton
:state=3,keypressed=33 0:state=4,etimerstart
:state=3,keypressed=33 1:state=3
:state=4,etimergreater=50:state=0,movelightoff