This should probably help you
void OnStart()
{
AddEntityCollideCallback("Player", "[NAME AREA]", "[FUNCTION RUN]", true, 1);
}
void [FUNCTION RUN](string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("[AREA LOOK]", 3.0f, 3.5f, "");
AddTimer("StopLook", 4.5f, "StopLook");
SetLightVisible("[NAME OF THE LAMP]", false);
GiveSanityDamage(10, true);
PlaySoundAtEntity("scare", "react_pant.snt", "Player", 0.5f, false);
}
void StopLook(string &in asTimer)
{
StopPlayerLookAt();
}
Explain :
AddEntityCollideCallback = Add Collide for Object/player, replace Name Area, Function Run
StartPlayerLookAt = Automatically look at object, replace Area Look
AddTimer = Timer for stop look, nothing to replace
SetLightVisible = Set light visible or not, replace Name of the lamp and test if working, i never use this, if you have many other lamp, added another SetLightVisible.
GiveSanityDamage = Give sanity damage to the player, 10 is the number damage
PlaySoundAtEntity = Play a sound, i already put react_pant
StopPlayerLookAt = Stop the automatically look.
Thats all.