Add ZTeleStopTimer to reduce duplicated code.
This change also requires that timers are stopped when clients disconnects.
This commit is contained in:
parent
8e6d4f0f35
commit
918dd3100b
|
@ -335,6 +335,7 @@ public OnClientDisconnect(client)
|
||||||
ZSpawnOnClientDisconnect(client);
|
ZSpawnOnClientDisconnect(client);
|
||||||
VolOnPlayerDisconnect(client);
|
VolOnPlayerDisconnect(client);
|
||||||
ImmunityOnClientDisconnect(client);
|
ImmunityOnClientDisconnect(client);
|
||||||
|
ZTeleOnClientDisconnect(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -69,8 +69,7 @@ ZTeleOnCommandsCreate()
|
||||||
*/
|
*/
|
||||||
ZTeleClientInit(client)
|
ZTeleClientInit(client)
|
||||||
{
|
{
|
||||||
// Reset timer handle.
|
ZTeleStopTimer(client);
|
||||||
tZTele[client] = INVALID_HANDLE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -86,14 +85,7 @@ ZTeleOnClientSpawn(client)
|
||||||
// Get spawn location.
|
// Get spawn location.
|
||||||
GetClientAbsOrigin(client, g_vecZTeleSpawn[client]);
|
GetClientAbsOrigin(client, g_vecZTeleSpawn[client]);
|
||||||
|
|
||||||
// If timer is running, kill it.
|
ZTeleStopTimer(client);
|
||||||
if (tZTele[client] != INVALID_HANDLE)
|
|
||||||
{
|
|
||||||
KillTimer(tZTele[client]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reset timer handle.
|
|
||||||
tZTele[client] = INVALID_HANDLE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -103,14 +95,12 @@ ZTeleOnClientSpawn(client)
|
||||||
*/
|
*/
|
||||||
ZTeleOnClientDeath(client)
|
ZTeleOnClientDeath(client)
|
||||||
{
|
{
|
||||||
// If timer is running, kill it.
|
ZTeleStopTimer(client);
|
||||||
if (tZTele[client] != INVALID_HANDLE)
|
|
||||||
{
|
|
||||||
KillTimer(tZTele[client]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset timer handle.
|
ZTeleOnClientDisconnect(client)
|
||||||
tZTele[client] = INVALID_HANDLE;
|
{
|
||||||
|
ZTeleStopTimer(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -120,14 +110,7 @@ ZTeleOnClientDeath(client)
|
||||||
*/
|
*/
|
||||||
ZTeleOnClientInfected(client)
|
ZTeleOnClientInfected(client)
|
||||||
{
|
{
|
||||||
// If timer is running, kill it.
|
ZTeleStopTimer(client);
|
||||||
if (tZTele[client] != INVALID_HANDLE)
|
|
||||||
{
|
|
||||||
KillTimer(tZTele[client]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reset timer handle.
|
|
||||||
tZTele[client] = INVALID_HANDLE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -460,3 +443,12 @@ public Action:ZTeleTimer(Handle:timer, any:client)
|
||||||
// Allow timer to continue repeating.
|
// Allow timer to continue repeating.
|
||||||
return Plugin_Continue;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ZTeleStopTimer(client)
|
||||||
|
{
|
||||||
|
if (tZTele[client] != INVALID_HANDLE)
|
||||||
|
{
|
||||||
|
KillTimer(tZTele[client]);
|
||||||
|
}
|
||||||
|
tZTele[client] = INVALID_HANDLE;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user