fix bugs
This commit is contained in:
parent
55a7885835
commit
a7caf1de7b
@ -164,7 +164,7 @@ bool:RespawnSpawnClient(client, bool:zombie = false, bool:zombieIfSuicide = fals
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get respawn condition.
|
// Get respawn condition.
|
||||||
new RespawnCondition:condition = RespawnToContition(zombie, zombieIfSuicide);
|
new RespawnCondition:condition = RespawnToCondition(zombie, zombieIfSuicide);
|
||||||
|
|
||||||
// Trigger API forward.
|
// Trigger API forward.
|
||||||
new Action:result = APIOnClientRespawn(client, condition);
|
new Action:result = APIOnClientRespawn(client, condition);
|
||||||
@ -255,7 +255,7 @@ public Action:RespawnTimer(Handle:timer, any:client)
|
|||||||
/**
|
/**
|
||||||
* Converts separate conditions into a single condition value.
|
* Converts separate conditions into a single condition value.
|
||||||
*/
|
*/
|
||||||
RespawnCondition:RespawnToContition(bool:zombie, bool:zombieIfSuicide)
|
RespawnCondition:RespawnToCondition(bool:zombie, bool:zombieIfSuicide)
|
||||||
{
|
{
|
||||||
if (zombie)
|
if (zombie)
|
||||||
{
|
{
|
||||||
|
@ -142,18 +142,18 @@ ZSpawnOnClientClassPost(client)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is the client death and not source-tv?
|
// Is the client dead and not source-tv?
|
||||||
if (!IsPlayerAlive(client) && !IsClientSourceTV(client))
|
if (!IsPlayerAlive(client) && !IsClientSourceTV(client))
|
||||||
{
|
{
|
||||||
// Get our zspawn condition.
|
// Get our zspawn condition.
|
||||||
new ZSpawnCondition:condition = GetZSpawnCondition();
|
new ZSpawnCondition:condition = GetZSpawnCondition(client);
|
||||||
|
|
||||||
switch(condition)
|
switch(condition)
|
||||||
{
|
{
|
||||||
case ZSpawn_Human, ZSpawn_Zombie:
|
case ZSpawn_Human, ZSpawn_Zombie:
|
||||||
{
|
{
|
||||||
// Respawn client.
|
// ZSpawn client.
|
||||||
CS_RespawnPlayer(client);
|
ZSpawnClient(client, false, false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -170,7 +170,7 @@ ZSpawnOnClientSpawn(client)
|
|||||||
if (ZRIsClientOnTeam(client) && InfectHasZombieSpawned())
|
if (ZRIsClientOnTeam(client) && InfectHasZombieSpawned())
|
||||||
{
|
{
|
||||||
// Get our zspawn condition.
|
// Get our zspawn condition.
|
||||||
new ZSpawnCondition:condition = GetZSpawnCondition();
|
new ZSpawnCondition:condition = GetZSpawnCondition(client);
|
||||||
|
|
||||||
switch(condition)
|
switch(condition)
|
||||||
{
|
{
|
||||||
@ -282,20 +282,24 @@ ZSpawnOnRoundEnd()
|
|||||||
* @param zombie (Optional) If you are forcing spawn, you must override the team here.
|
* @param zombie (Optional) If you are forcing spawn, you must override the team here.
|
||||||
* @return True if successful, false otherwise.
|
* @return True if successful, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool:ZSpawnClient(client, bool:force = false, bool:zombie = false)
|
bool:ZSpawnClient(client, bool:force = false, bool:zombie = false, bool error = true)
|
||||||
{
|
{
|
||||||
// If zspawn is disabled, then stop.
|
// If zspawn is disabled, then stop.
|
||||||
new bool:zspawn = GetConVarBool(g_hCvarsList[CVAR_ZSPAWN]);
|
new bool:zspawn = GetConVarBool(g_hCvarsList[CVAR_ZSPAWN]);
|
||||||
if (!force && !zspawn)
|
if (!force && !zspawn)
|
||||||
|
{
|
||||||
|
if (error)
|
||||||
{
|
{
|
||||||
TranslationPrintToChat(client, "Feature is disabled");
|
TranslationPrintToChat(client, "Feature is disabled");
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If client isn't on a team, then stop.
|
// If client isn't on a team, then stop.
|
||||||
if (!ZRIsClientOnTeam(client))
|
if (!ZRIsClientOnTeam(client))
|
||||||
{
|
{
|
||||||
if (!force)
|
if (!force && error)
|
||||||
{
|
{
|
||||||
// Tell client the command may only be used when on a team.
|
// Tell client the command may only be used when on a team.
|
||||||
TranslationPrintToChat(client, "Must be on team");
|
TranslationPrintToChat(client, "Must be on team");
|
||||||
@ -307,7 +311,7 @@ bool:ZSpawnClient(client, bool:force = false, bool:zombie = false)
|
|||||||
// If client is alive, then stop.
|
// If client is alive, then stop.
|
||||||
if (IsPlayerAlive(client))
|
if (IsPlayerAlive(client))
|
||||||
{
|
{
|
||||||
if (!force)
|
if (!force && error)
|
||||||
{
|
{
|
||||||
// Tell client the command may only be used when dead.
|
// Tell client the command may only be used when dead.
|
||||||
TranslationPrintToChat(client, "Must be dead");
|
TranslationPrintToChat(client, "Must be dead");
|
||||||
@ -319,9 +323,13 @@ bool:ZSpawnClient(client, bool:force = false, bool:zombie = false)
|
|||||||
// Block if client has already played during this round.
|
// Block if client has already played during this round.
|
||||||
new blockrejoin = GetConVarBool(g_hCvarsList[CVAR_ZSPAWN_BLOCK_REJOIN]);
|
new blockrejoin = GetConVarBool(g_hCvarsList[CVAR_ZSPAWN_BLOCK_REJOIN]);
|
||||||
if (!force && SteamidCacheClientExists(g_hZSpawnSteamIDCache, client) && blockrejoin)
|
if (!force && SteamidCacheClientExists(g_hZSpawnSteamIDCache, client) && blockrejoin)
|
||||||
|
{
|
||||||
|
if (error)
|
||||||
{
|
{
|
||||||
// Tell client the command may only be used when joining late.
|
// Tell client the command may only be used when joining late.
|
||||||
TranslationPrintToChat(client, "ZSpawn double spawn");
|
TranslationPrintToChat(client, "ZSpawn double spawn");
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -331,7 +339,7 @@ bool:ZSpawnClient(client, bool:force = false, bool:zombie = false)
|
|||||||
if (!force)
|
if (!force)
|
||||||
{
|
{
|
||||||
// Get our zspawn condition.
|
// Get our zspawn condition.
|
||||||
new ZSpawnCondition:condition = GetZSpawnCondition();
|
new ZSpawnCondition:condition = GetZSpawnCondition(client);
|
||||||
|
|
||||||
switch(condition)
|
switch(condition)
|
||||||
{
|
{
|
||||||
@ -340,8 +348,12 @@ bool:ZSpawnClient(client, bool:force = false, bool:zombie = false)
|
|||||||
// Get timelimit.
|
// Get timelimit.
|
||||||
new Float:zspawntime = GetConVarFloat(g_hCvarsList[CVAR_ZSPAWN_TIMELIMIT_TIME]);
|
new Float:zspawntime = GetConVarFloat(g_hCvarsList[CVAR_ZSPAWN_TIMELIMIT_TIME]);
|
||||||
|
|
||||||
|
if (error)
|
||||||
|
{
|
||||||
// Tell client the timelimit for this command has expired.
|
// Tell client the timelimit for this command has expired.
|
||||||
TranslationPrintToChat(client, "ZSpawn timelimit", RoundToNearest(zspawntime));
|
TranslationPrintToChat(client, "ZSpawn timelimit", RoundToNearest(zspawntime));
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
case ZSpawn_Human:
|
case ZSpawn_Human:
|
||||||
@ -353,10 +365,6 @@ bool:ZSpawnClient(client, bool:force = false, bool:zombie = false)
|
|||||||
teamzombie = true;
|
teamzombie = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Client has been infected this round, respawning as a zombie.
|
|
||||||
if(g_bZSpawnClientInfected[client])
|
|
||||||
teamzombie = true;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -559,7 +567,7 @@ public Action:ZSpawnTimer(Handle:timer)
|
|||||||
/**
|
/**
|
||||||
* Get ZSpawn condition.
|
* Get ZSpawn condition.
|
||||||
*/
|
*/
|
||||||
ZSpawnCondition:GetZSpawnCondition()
|
ZSpawnCondition:GetZSpawnCondition(int client)
|
||||||
{
|
{
|
||||||
new ZSpawnCondition:condition;
|
new ZSpawnCondition:condition;
|
||||||
|
|
||||||
@ -600,5 +608,9 @@ ZSpawnCondition:GetZSpawnCondition()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Client has been infected this round, respawning as a zombie.
|
||||||
|
if(condition == ZSpawn_Human && g_bZSpawnClientInfected[client])
|
||||||
|
condition = ZSpawn_Zombie;
|
||||||
|
|
||||||
return condition;
|
return condition;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user