Fixed memory leak, fixed disconnect bug.
This commit is contained in:
parent
0f15efaa85
commit
f35d8cb381
@ -262,6 +262,7 @@ public Action:PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
|
|||||||
RespawnOnClientDeath(index, attacker, weapon);
|
RespawnOnClientDeath(index, attacker, weapon);
|
||||||
ZHPOnClientDeath(index);
|
ZHPOnClientDeath(index);
|
||||||
|
|
||||||
|
// Terminate round if round is over.
|
||||||
new RoundEndOutcome:outcome;
|
new RoundEndOutcome:outcome;
|
||||||
if (RoundEndGetRoundStatus(outcome))
|
if (RoundEndGetRoundStatus(outcome))
|
||||||
{
|
{
|
||||||
|
@ -377,6 +377,9 @@ RoundEndBalanceTeams(bool:spawn = false)
|
|||||||
// Respawn client.
|
// Respawn client.
|
||||||
CS_RespawnPlayer(client);
|
CS_RespawnPlayer(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy handle.
|
||||||
|
CloseHandle(arrayEligibleClients);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -398,33 +398,47 @@ JumpBoost(client, Float:distance, Float:height)
|
|||||||
*/
|
*/
|
||||||
PlayerLeft(client)
|
PlayerLeft(client)
|
||||||
{
|
{
|
||||||
|
// If zombie hasn't spawned, then stop.
|
||||||
|
if (!g_bZombieSpawned)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// If client is dead, then stop.
|
// If client is dead, then stop.
|
||||||
if (!IsPlayerAlive(client))
|
if (!IsPlayerAlive(client))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If client isn't a zombie, then stop.
|
// Get zombie flag on client.
|
||||||
if (!IsPlayerZombie(client))
|
new zombieclient = IsPlayerZombie(client);
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize count variables
|
// Initialize count variables
|
||||||
new zombiecount;
|
new zombiecount;
|
||||||
new humancount;
|
new humancount;
|
||||||
|
|
||||||
// Count valid clients. (true to only allow living clients)
|
// Count valid clients.
|
||||||
ZRCountValidClients(zombiecount, humancount);
|
ZRCountValidClients(zombiecount, humancount);
|
||||||
|
|
||||||
// If there are other zombies besides the disconnecting player, then stop.
|
// If client is a human, and is the last one, then terminate round.
|
||||||
if (zombiecount - 1)
|
if (IsPlayerHuman(client) && humancount <= 1)
|
||||||
{
|
{
|
||||||
|
// If there are no more clients in the server, then stop.
|
||||||
|
if (!ZRTeamHasClients(CS_TEAM_T))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Manually terminate round.
|
||||||
|
RoundEndTerminateRound(ZombiesWin);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there is 1 or no humans left, then stop.
|
// We know here that player is a zombie.
|
||||||
if (humancount <= 1)
|
|
||||||
|
// If there are other zombies (ignoring this zombie), then stop.
|
||||||
|
if (zombiecount - 1)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user