01-01-2013, 04:43 PM
PHP Code:
void OnStart()
{
for (int i = 0; i < 14; i++)
{
AddEntityCollideCallback("Player", "ShadowArea_"+i, "ShadowDamage", true, 0);
}
}
void ShadowDamage(string &in asParent, string &in asChild, int alState)
{
if (alState == 1)
{
AddTimer("damage", 2.0f, "TimerDamage");
}
else if (alState == -1)
{
RemoveTimer("damage");
}
}
void TimerDamage(string &in asTimer)
{
GivePlayerDamage(20, "BloodSplat", true, true);
PlayGuiSound("attack_claw_hit.snt", 0.5f);
AddTimer("damage", RandFloat(5.0f, 7.0f), "TimerDamage");
}
I'm trying to make an area that damages you ever 5-7 seconds while you're inside, but stops damaging you when you leave it. However, even after I leave the area, I keep getting damaged over and over. Am I missing something here?