Small timer code cleanup.

This commit is contained in:
richard 2009-12-02 23:35:20 +01:00
parent abd4afe4c7
commit e8ead727c2
2 changed files with 5 additions and 8 deletions

View File

@ -38,13 +38,10 @@ ClassHealthRegenInitialize(client, Float:interval, amount, max)
ClassHealthRegenStart(client, Float:interval) ClassHealthRegenStart(client, Float:interval)
{ {
// Kill the timer if it exist. // Stop timer if it already exist.
if (tHealthRegen[client] != INVALID_HANDLE) ClassHealthRegenStop(client);
{
KillTimer(tHealthRegen[client]);
tHealthRegen[client] = INVALID_HANDLE;
}
// Create new timer.
tHealthRegen[client] = CreateTimer(interval, ClassHealthRegenTimer, client, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE); tHealthRegen[client] = CreateTimer(interval, ClassHealthRegenTimer, client, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
} }

View File

@ -140,12 +140,12 @@ new Float:VolPlayerCountDown[MAXPLAYERS + 1][ZR_VOLUMES_MAX];
* *
* Note: Some features may have its own timer for actions on players. * Note: Some features may have its own timer for actions on players.
*/ */
new Handle:hVolUpdateTimer; new Handle:hVolUpdateTimer = INVALID_HANDLE;
/** /**
* The handle for a timer that do count down on trigger delays. * The handle for a timer that do count down on trigger delays.
*/ */
new Handle:hVolTriggerTimer; new Handle:hVolTriggerTimer = INVALID_HANDLE;
/** /**
* Cached interval value for trigger timer. * Cached interval value for trigger timer.