11-14-2011, 08:33 AM
I have a problem regarding the removal of a timer. I have a code (shown below) that opens a door, but even if I have a RemoveTimer(); script at the end of the code, the timer STILL keeps going. How do I make the timer stop?
Quote:void DoorTickTimer(string &in asTimer)
{
if(asTimer == "Ticking"){
if(GetLocalVarInt("DoorPush") < 10){
SetSwingDoorDisableAutoClose("mansion_8", true);
SetSwingDoorClosed("mansion_8", false, true);
AddLocalVarInt("DoorPush", 1);
AddPropImpulse("mansion_8", 0.2f, 0.0f, 0.0f, "");
AddTimer("Ticking", 0.1f, "DoorTickTimer");
}
}
if(GetLocalVarInt("DoorPush") == 10){
AddDebugMessage("10 Pushes!", true);
AddTimer("FreezeDoor", 1.0f, "DoorTickTimer");
}
if(asTimer == "FreezeDoor"){
SetPropStaticPhysics("mansion_8", true);
AddDebugMessage("Froze door!", true);
RemoveTimer("DoorTickTimer");
}
}