Merged heads.

This commit is contained in:
richard 2009-06-19 01:28:29 +02:00
commit 10fd954ede
5 changed files with 118 additions and 56 deletions

View File

@ -351,6 +351,12 @@
"en" "Player @green{1} @defaulthas been successfully infected." "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" "Infect command infect unsuccessful"
{ {
"#format" "{1:s}" "#format" "{1:s}"
@ -369,11 +375,6 @@
"en" "Player @green{1} @defaultis already a human." "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) // Damage (core)
// =========================== // ===========================

View File

@ -836,12 +836,6 @@ public Action:InfectInfectCommand(client, argc)
return Plugin_Handled; 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]; decl String:target[MAX_NAME_LENGTH], String:targetname[MAX_NAME_LENGTH];
new targets[MAXPLAYERS], bool:tn_is_ml, result; new targets[MAXPLAYERS], bool:tn_is_ml, result;
@ -849,7 +843,7 @@ public Action:InfectInfectCommand(client, argc)
GetCmdArg(1, target, sizeof(target)); GetCmdArg(1, target, sizeof(target));
// Find a 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. // Check if there was a problem finding a client.
if (result <= 0) if (result <= 0)
@ -858,9 +852,57 @@ public Action:InfectInfectCommand(client, argc)
return Plugin_Handled; return Plugin_Handled;
} }
// Check if client is a human before turning into zombie. new bool:zombiespawned = g_bZombieSpawned;
if (InfectIsClientHuman(targets[0]))
// 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; new bool:respawnoverride, bool:respawn;
decl String:strRespawn[8]; decl String:strRespawn[8];
@ -874,16 +916,29 @@ public Action:InfectInfectCommand(client, argc)
respawn = bool:StringToInt(strRespawn); respawn = bool:StringToInt(strRespawn);
} }
// Turn client into a zombie. // If zombie hasn't spawned, then make targetted player(s) mother zombies.
InfectHumanToZombie(targets[0], _, _, respawnoverride, respawn); if (!zombiespawned)
{
// Turn client into a mother zombie.
InfectHumanToZombie(targets[x], _, true, respawnoverride, respawn);
// Tell admin command was successful. // If there was only 1 player targetted, then let admin know the outcome of the command.
TranslationReplyToCommand(client, "Infect command infect successful", targetname); if (result == 1)
} {
else TranslationReplyToCommand(client, "Infect command infect mother successful", targetname);
{ }
// Tell admin command was unsuccessful.
TranslationReplyToCommand(client, "Infect command infect unsuccessful", 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; return Plugin_Handled;
@ -905,12 +960,6 @@ public Action:InfectHumanCommand(client, argc)
return Plugin_Handled; 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]; decl String:target[MAX_NAME_LENGTH], String:targetname[MAX_NAME_LENGTH];
new targets[MAXPLAYERS], bool:tn_is_ml, result; new targets[MAXPLAYERS], bool:tn_is_ml, result;
@ -918,7 +967,7 @@ public Action:InfectHumanCommand(client, argc)
GetCmdArg(1, target, sizeof(target)); GetCmdArg(1, target, sizeof(target));
// Find a 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. // Check if there was a problem finding a client.
if (result <= 0) if (result <= 0)
@ -927,30 +976,42 @@ public Action:InfectHumanCommand(client, argc)
return Plugin_Handled; return Plugin_Handled;
} }
// Check if client is a human before turning into zombie. // x = Client index.
if (InfectIsClientInfected(targets[0])) for (new x = 0; x < result; x++)
{ {
new bool:respawn, bool:protect; // Check if client is a human before turning into zombie.
decl String:strRespawn[8], String:strProtect[8]; if (InfectIsClientInfected(targets[x]))
{
new bool:respawn, bool:protect;
decl String:strRespawn[8], String:strProtect[8];
// Get respawn&protect parameters // Get respawn&protect parameters
GetCmdArg(2, strRespawn, sizeof(strRespawn)); GetCmdArg(2, strRespawn, sizeof(strRespawn));
GetCmdArg(3, strProtect, sizeof(strProtect)); GetCmdArg(3, strProtect, sizeof(strProtect));
// If parameter exists then cast it into a bool and feed it to "humanize" function. // If parameter exists then cast it into a bool and feed it to "humanize" function.
respawn = (strRespawn[0]) ? (bool:StringToInt(strRespawn)) : false; respawn = (strRespawn[0]) ? (bool:StringToInt(strRespawn)) : false;
protect = (strProtect[0]) ? (bool:StringToInt(strProtect)) : false; protect = (strProtect[0]) ? (bool:StringToInt(strProtect)) : false;
// Turn client into a zombie. // Turn client into a zombie.
InfectZombieToHuman(targets[0], respawn, protect); InfectZombieToHuman(targets[x], respawn, protect);
// Tell admin command was successful. // If there was only 1 player targetted, then let admin know the outcome of the command.
TranslationReplyToCommand(client, "Infect command human successful", targetname); if (result == 1)
} {
else // Tell admin command was successful.
{ TranslationReplyToCommand(client, "Infect command human successful", targetname);
// Tell admin command was unsuccessful. }
TranslationReplyToCommand(client, "Infect command human unsuccessful", 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; return Plugin_Handled;

View File

@ -234,7 +234,7 @@ bool:RoundEndGetRoundStatus(&RoundEndOutcome:outcome)
new humancount; new humancount;
// Count valid clients. (true to only allow living clients) // 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 there are no clients on either teams, then stop.
if (!zombiecount && !humancount) if (!zombiecount && !humancount)

View File

@ -33,7 +33,7 @@ enum VolTypeAnticamp
Float:anticamp_interval, /** How often to trigger an action. */ Float:anticamp_interval, /** How often to trigger an action. */
Handle:anticamp_timer, /** Action timer handle. */ 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. */ Float:anticamp_amount, /** Amount depending on action type. Usually time in seconds or damage amount. */
VolAnticampeWarningType:anticamp_warning, /** How to warn the player. */ VolAnticampeWarningType:anticamp_warning, /** How to warn the player. */

View File

@ -335,7 +335,7 @@ WeaponsOnRoundEnd()
* *
* @param index The weapon index. * @param index The weapon index.
*/ */
WeaponsClearCache(index) stock WeaponsClearCache(index)
{ {
// Get array handle of weapon at given index. // Get array handle of weapon at given index.
new Handle:hWeapon = GetArrayCell(arrayWeapons, index); new Handle:hWeapon = GetArrayCell(arrayWeapons, index);