Removed old tHandles array, updated antistick a bit (just moved stuff).

This commit is contained in:
Greyscale 2009-04-21 02:03:35 +02:00
parent 1ec47ef154
commit 0f15efaa85
4 changed files with 17 additions and 75 deletions

View File

@ -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()

View File

@ -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);
}
/**

View File

@ -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.

View File

@ -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.
*