zr_infect now infects mother zombie if used before it has spawned.
* Fixed a serious bug that could delay the game, the round end checker took dead clients in the count, so 1 dead ct and 9 zombies didn't end the game. * Small typo fix in anticamp, and got rid of a warning.
This commit is contained in:
parent
9cac025358
commit
01653a2636
@ -351,6 +351,12 @@
|
||||
"en" "Player @green{1} @defaulthas been successfully infected."
|
||||
}
|
||||
|
||||
"Infect command infect mother successful"
|
||||
{
|
||||
"#format" "{1:s}"
|
||||
"en" "Player @green{1} @defaulthas been successfully infected as the mother zombie."
|
||||
}
|
||||
|
||||
"Infect command infect unsuccessful"
|
||||
{
|
||||
"#format" "{1:s}"
|
||||
@ -369,11 +375,6 @@
|
||||
"en" "Player @green{1} @defaultis already a human."
|
||||
}
|
||||
|
||||
"Infect command zombie has not spawned"
|
||||
{
|
||||
"en" "The mother zombie must spawn before player infection states can be changed."
|
||||
}
|
||||
|
||||
// ===========================
|
||||
// Damage (core)
|
||||
// ===========================
|
||||
|
@ -836,12 +836,6 @@ public Action:InfectInfectCommand(client, argc)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
if (!g_bZombieSpawned)
|
||||
{
|
||||
TranslationReplyToCommand(client, "Infect command zombie has not spawned");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
decl String:target[MAX_NAME_LENGTH], String:targetname[MAX_NAME_LENGTH];
|
||||
new targets[MAXPLAYERS], bool:tn_is_ml, result;
|
||||
|
||||
@ -849,7 +843,7 @@ public Action:InfectInfectCommand(client, argc)
|
||||
GetCmdArg(1, target, sizeof(target));
|
||||
|
||||
// Find a target.
|
||||
result = ProcessTargetString(target, client, targets, sizeof(targets), COMMAND_FILTER_ALIVE | COMMAND_FILTER_NO_MULTI, targetname, sizeof(targetname), tn_is_ml);
|
||||
result = ProcessTargetString(target, client, targets, sizeof(targets), COMMAND_FILTER_ALIVE , targetname, sizeof(targetname), tn_is_ml);
|
||||
|
||||
// Check if there was a problem finding a client.
|
||||
if (result <= 0)
|
||||
@ -858,9 +852,57 @@ public Action:InfectInfectCommand(client, argc)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
// Check if client is a human before turning into zombie.
|
||||
if (InfectIsClientHuman(targets[0]))
|
||||
new bool:zombiespawned = g_bZombieSpawned;
|
||||
|
||||
// If zombie hasn't spawned, then make targetted player(s) mother zombies.
|
||||
if (!zombiespawned)
|
||||
{
|
||||
// Stop mother infect timer.
|
||||
if (tInfect != INVALID_HANDLE)
|
||||
{
|
||||
KillTimer(tInfect);
|
||||
tInfect = INVALID_HANDLE;
|
||||
}
|
||||
|
||||
// Move all clients to CT
|
||||
for (new x = 1; x <= MaxClients; x++)
|
||||
{
|
||||
// If client isn't in-game, then stop.
|
||||
if (!IsClientInGame(x))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// If client is dead, then stop.
|
||||
if (!IsPlayerAlive(x))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Switch client to CT team.
|
||||
CS_SwitchTeam(x, CS_TEAM_CT);
|
||||
}
|
||||
|
||||
// Tell the plugin a mother zombie has spawned.
|
||||
g_bZombieSpawned = true;
|
||||
}
|
||||
|
||||
// x = Client index.
|
||||
for (new x = 0; x < result; x++)
|
||||
{
|
||||
// Check if client is a human before turning into zombie.
|
||||
if (!InfectIsClientHuman(targets[x]))
|
||||
{
|
||||
// If there was only 1 player targetted, then let admin know the command was unsuccessful.
|
||||
if (result == 1)
|
||||
{
|
||||
// Tell admin command was unsuccessful.
|
||||
TranslationReplyToCommand(client, "Infect command infect unsuccessful", targetname);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
new bool:respawnoverride, bool:respawn;
|
||||
decl String:strRespawn[8];
|
||||
|
||||
@ -874,16 +916,29 @@ public Action:InfectInfectCommand(client, argc)
|
||||
respawn = bool:StringToInt(strRespawn);
|
||||
}
|
||||
|
||||
// Turn client into a zombie.
|
||||
InfectHumanToZombie(targets[0], _, _, respawnoverride, respawn);
|
||||
// If zombie hasn't spawned, then make targetted player(s) mother zombies.
|
||||
if (!zombiespawned)
|
||||
{
|
||||
// Turn client into a mother zombie.
|
||||
InfectHumanToZombie(targets[x], _, true, respawnoverride, respawn);
|
||||
|
||||
// Tell admin command was successful.
|
||||
TranslationReplyToCommand(client, "Infect command infect successful", targetname);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Tell admin command was unsuccessful.
|
||||
TranslationReplyToCommand(client, "Infect command infect unsuccessful", targetname);
|
||||
// If there was only 1 player targetted, then let admin know the outcome of the command.
|
||||
if (result == 1)
|
||||
{
|
||||
TranslationReplyToCommand(client, "Infect command infect mother successful", targetname);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// Turn client into a zombie.
|
||||
InfectHumanToZombie(targets[x], _, false, respawnoverride, respawn);
|
||||
|
||||
// If there was only 1 player targetted, then let admin know the outcome of the command.
|
||||
if (result == 1)
|
||||
{
|
||||
TranslationReplyToCommand(client, "Infect command infect successful", targetname);
|
||||
}
|
||||
}
|
||||
|
||||
return Plugin_Handled;
|
||||
@ -905,12 +960,6 @@ public Action:InfectHumanCommand(client, argc)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
if (!g_bZombieSpawned)
|
||||
{
|
||||
TranslationReplyToCommand(client, "Infect command zombie has not spawned");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
decl String:target[MAX_NAME_LENGTH], String:targetname[MAX_NAME_LENGTH];
|
||||
new targets[MAXPLAYERS], bool:tn_is_ml, result;
|
||||
|
||||
@ -918,7 +967,7 @@ public Action:InfectHumanCommand(client, argc)
|
||||
GetCmdArg(1, target, sizeof(target));
|
||||
|
||||
// Find a target.
|
||||
result = ProcessTargetString(target, client, targets, sizeof(targets), COMMAND_FILTER_ALIVE | COMMAND_FILTER_NO_MULTI, targetname, sizeof(targetname), tn_is_ml);
|
||||
result = ProcessTargetString(target, client, targets, sizeof(targets), COMMAND_FILTER_ALIVE , targetname, sizeof(targetname), tn_is_ml);
|
||||
|
||||
// Check if there was a problem finding a client.
|
||||
if (result <= 0)
|
||||
@ -927,30 +976,42 @@ public Action:InfectHumanCommand(client, argc)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
// Check if client is a human before turning into zombie.
|
||||
if (InfectIsClientInfected(targets[0]))
|
||||
// x = Client index.
|
||||
for (new x = 0; x < result; x++)
|
||||
{
|
||||
new bool:respawn, bool:protect;
|
||||
decl String:strRespawn[8], String:strProtect[8];
|
||||
// Check if client is a human before turning into zombie.
|
||||
if (InfectIsClientInfected(targets[x]))
|
||||
{
|
||||
new bool:respawn, bool:protect;
|
||||
decl String:strRespawn[8], String:strProtect[8];
|
||||
|
||||
// Get respawn&protect parameters
|
||||
GetCmdArg(2, strRespawn, sizeof(strRespawn));
|
||||
GetCmdArg(3, strProtect, sizeof(strProtect));
|
||||
// Get respawn&protect parameters
|
||||
GetCmdArg(2, strRespawn, sizeof(strRespawn));
|
||||
GetCmdArg(3, strProtect, sizeof(strProtect));
|
||||
|
||||
// If parameter exists then cast it into a bool and feed it to "humanize" function.
|
||||
respawn = (strRespawn[0]) ? (bool:StringToInt(strRespawn)) : false;
|
||||
protect = (strProtect[0]) ? (bool:StringToInt(strProtect)) : false;
|
||||
// If parameter exists then cast it into a bool and feed it to "humanize" function.
|
||||
respawn = (strRespawn[0]) ? (bool:StringToInt(strRespawn)) : false;
|
||||
protect = (strProtect[0]) ? (bool:StringToInt(strProtect)) : false;
|
||||
|
||||
// Turn client into a zombie.
|
||||
InfectZombieToHuman(targets[0], respawn, protect);
|
||||
// Turn client into a zombie.
|
||||
InfectZombieToHuman(targets[x], respawn, protect);
|
||||
|
||||
// Tell admin command was successful.
|
||||
TranslationReplyToCommand(client, "Infect command human successful", targetname);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Tell admin command was unsuccessful.
|
||||
TranslationReplyToCommand(client, "Infect command human unsuccessful", targetname);
|
||||
// If there was only 1 player targetted, then let admin know the outcome of the command.
|
||||
if (result == 1)
|
||||
{
|
||||
// Tell admin command was successful.
|
||||
TranslationReplyToCommand(client, "Infect command human successful", targetname);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// If there was only 1 player targetted, then let admin know the command was unsuccessful.
|
||||
if (result == 1)
|
||||
{
|
||||
// Tell admin command was unsuccessful.
|
||||
TranslationReplyToCommand(client, "Infect command human unsuccessful", targetname);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Plugin_Handled;
|
||||
|
@ -234,7 +234,7 @@ bool:RoundEndGetRoundStatus(&RoundEndOutcome:outcome)
|
||||
new humancount;
|
||||
|
||||
// Count valid clients. (true to only allow living clients)
|
||||
ZRCountValidClients(zombiecount, humancount);
|
||||
ZRCountValidClients(zombiecount, humancount, true);
|
||||
|
||||
// If there are no clients on either teams, then stop.
|
||||
if (!zombiecount && !humancount)
|
||||
|
@ -33,7 +33,7 @@ enum VolTypeAnticamp
|
||||
Float:anticamp_interval, /** How often to trigger an action. */
|
||||
Handle:anticamp_timer, /** Action timer handle. */
|
||||
|
||||
VolAnticampAction:antivamp_action, /** What to do with players in anti-camp volumes */
|
||||
VolAnticampAction:anticamp_action, /** What to do with players in anti-camp volumes */
|
||||
Float:anticamp_amount, /** Amount depending on action type. Usually time in seconds or damage amount. */
|
||||
|
||||
VolAnticampeWarningType:anticamp_warning, /** How to warn the player. */
|
||||
|
@ -335,7 +335,7 @@ WeaponsOnRoundEnd()
|
||||
*
|
||||
* @param index The weapon index.
|
||||
*/
|
||||
WeaponsClearCache(index)
|
||||
stock WeaponsClearCache(index)
|
||||
{
|
||||
// Get array handle of weapon at given index.
|
||||
new Handle:hWeapon = GetArrayCell(arrayWeapons, index);
|
||||
|
Loading…
Reference in New Issue
Block a user