Personally, I would do something like this:
PHP Code:
//#CLIENTSIDE
function onPlayerEnters(){
setEffectMode(1);
setColorEffect(1, 1, 1, 1);
dontBlockLocal();
drawOverPlayer();
setTimer(0.05);
}
function onTimeout(){
if (player.x+1.5 in |this.x-1, this.x+this.width+1| && player.y+2 in |this, 37|){
setColorEffect(1, 1, 1, 0.7);
} else {
setColorEffect(1, 1, 1, 1);
}
setTimer(0.05);
}
Then you can put it in a class and use it for other things like it.