For some reason, this worked:
void OpenDoor(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("prison_section_2", false, false);
SetSwingDoorDisableAutoClose("prison_section_2", true);
AddTimer("swing_door", 0.01f, "TimerDoor");
SetEntityPlayerLookAtCallback("prison_section_2", "RemoveTimerCreak", true);
}
void TimerDoor(string &in asTimer)
{
if(asTimer == "swing_door")
{
AddPropForce("prison_section_2", 0.0f, 0.0f, 25.0f, "");
}
else
{
AddPropForce("prison_section_2", 0.0f, 0.0f, -95.0f, "");
}
AddTimer(asTimer, 0.03, "TimerDoor");
}
void RemoveTimerCreak(string &in asEntity, int alState)
{
RemoveTimer("swing_door");
PlaySoundAtEntity("pant", "react_scare.snt", "Player", 0.0f, false);
}
Also, it's way more precise because the 'react_scare'-sound will now always be played at the right time