diff --git a/src/zombiereloaded.sp b/src/zombiereloaded.sp index 432237c..9b3baa2 100644 --- a/src/zombiereloaded.sp +++ b/src/zombiereloaded.sp @@ -173,6 +173,7 @@ public OnMapStart() WeaponsLoad(); HitgroupsLoad(); SEffectsOnMapStart(); + AntiStickOnMapStart(); Anticamp_Startup(); } @@ -221,11 +222,6 @@ public OnClientPutInServer(client) SpawnProtectClientInit(client); RespawnClientInit(client); ZHPClientInit(client); - - for (new x = 0; x < MAXTIMERS; x++) - { - tHandles[client][x] = INVALID_HANDLE; - } } public OnClientDisconnect(client) @@ -237,33 +233,11 @@ public OnClientDisconnect(client) DamageOnClientDisconnect(client); WeaponsOnClientDisconnect(client); ZTeleResetClient(client); - - for (new x = 0; x < MAXTIMERS; x++) - { - if (tHandles[client][x] != INVALID_HANDLE) - { - KillTimer(tHandles[client][x]); - tHandles[client][x] = INVALID_HANDLE; - } - } } MapChangeCleanup() { tInfect = INVALID_HANDLE; - AntiStickReset(); - - // x = client index. - for (new x = 1; x <= MaxClients; x++) - { - for (new y = 0; y < MAXTIMERS; y++) - { - if (tHandles[x][y] != INVALID_HANDLE) - { - tHandles[x][y] = INVALID_HANDLE; - } - } - } } /*ZREnd() diff --git a/src/zr/antistick.inc b/src/zr/antistick.inc index 9b2807b..96254f2 100644 --- a/src/zr/antistick.inc +++ b/src/zr/antistick.inc @@ -21,39 +21,35 @@ */ new Handle:tAntiStick = INVALID_HANDLE; +/** + * Map is starting. +*/ +AntiStickOnMapStart() +{ + // Reset timer handle. + tAntiStick = INVALID_HANDLE; +} + /** * The round is starting. */ AntiStickOnRoundStart() { - // Restart antistick timer. - AntiStickRestart(); -} - -/** - * Restarts the AntiStickTimer function. -*/ -AntiStickRestart() -{ + // If timer is running, kill it. if (tAntiStick != INVALID_HANDLE) { KillTimer(tAntiStick); } + // If antistick is disabled, then stop. new bool:antistick = GetConVarBool(g_hCvarsList[CVAR_ANTISTICK]); - if (antistick) + if (!antistick) { - new Float:interval = GetConVarFloat(g_hCvarsList[CVAR_ANTISTICK_INTERVAL]); - tAntiStick = CreateTimer(interval, AntiStickTimer, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); + return; } -} - -/** - * Resets the handle that keeps track of the AntiStickTimer function. -*/ -AntiStickReset() -{ - tAntiStick = INVALID_HANDLE; + + new Float:interval = GetConVarFloat(g_hCvarsList[CVAR_ANTISTICK_INTERVAL]); + tAntiStick = CreateTimer(interval, AntiStickTimer, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); } /** diff --git a/src/zr/event.inc b/src/zr/event.inc index 3f5bf76..f6a92ba 100644 --- a/src/zr/event.inc +++ b/src/zr/event.inc @@ -126,15 +126,6 @@ public Action:PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast) { new index = GetClientOfUserId(GetEventInt(event, "userid")); - for (new x = 0; x < MAXTIMERS; x++) - { - if (tHandles[index][x] != INVALID_HANDLE) - { - KillTimer(tHandles[index][x]); - tHandles[index][x] = INVALID_HANDLE; - } - } - bZombie[index] = false; // Reset FOV and overlay. @@ -262,16 +253,6 @@ public Action:PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast) AddPlayerScore(attacker, bonus); } } - - // Kill various timers. - for (new x = 0; x < MAXTIMERS; x++) - { - if (tHandles[index][x] != INVALID_HANDLE) - { - KillTimer(tHandles[index][x]); - tHandles[index][x] = INVALID_HANDLE; - } - } } // Forward event to modules. diff --git a/src/zr/zombiereloaded.inc b/src/zr/zombiereloaded.inc index 8aa3501..1b24018 100644 --- a/src/zr/zombiereloaded.inc +++ b/src/zr/zombiereloaded.inc @@ -55,15 +55,6 @@ new Handle:ztele_startup_timer = INVALID_HANDLE; new Handle:ztele_countdown_timer[MAXPLAYERS + 1] = {INVALID_HANDLE, ...}; new Handle:ztele_cooldown_timer[MAXPLAYERS + 1] = {INVALID_HANDLE, ...}; - -// TODO: USE SEPARATE VARIABLE TO STORE TELEPORT TIMER HANDLE -// THEN WE CAN REMOVE tHandles ARRAY FOR GOOD. -#define MAXTIMERS 1 - -#define TTELE 1 - -new Handle:tHandles[MAXPLAYERS + 1][MAXTIMERS]; - /** * Converts string of "yes" or "no" to a boolean value. *