Small timer fixes. Added cvar zr_roundend_balance_teams. See details.

Added cvar for disabling team balancing on round end (for use with custom team balancer): zr_roundend_balance_teams. Disabling this will cause players to remain on their current team when a new round starts. If zombies win, everyone will remain on the terrorists team.
Fixed invalid handle error after a map change.
Fixed language code typo in translations.
Infection countdown is no longer displayed if the infection delay is just one second.
This commit is contained in:
Richard Helgeby 2011-12-27 09:05:27 +01:00
parent 3be9ce5511
commit ef175ca488
7 changed files with 19 additions and 12 deletions

View File

@ -362,7 +362,7 @@
"Infect countdown" "Infect countdown"
{ {
"en" "First infection in {1} seconds." "es" "First infection in {1} seconds."
} }
// Menu // Menu

View File

@ -361,7 +361,7 @@
"Infect countdown" "Infect countdown"
{ {
"en" "Første infeksjon om {1} sekunder." "no" "Første infeksjon om {1} sekunder."
} }
// Menu // Menu

View File

@ -362,7 +362,7 @@
"Infect countdown" "Infect countdown"
{ {
"en" "First infection in {1} seconds." "ru" "First infection in {1} seconds."
} }
// Menu // Menu

View File

@ -428,6 +428,9 @@ zr_roundend_overlays_zombie "overlays/zr/zombies_win"
// Default: "overlays/zr/humans_win" // Default: "overlays/zr/humans_win"
zr_roundend_overlays_human "overlays/zr/humans_win" zr_roundend_overlays_human "overlays/zr/humans_win"
// Balances the team every time the round ends. Disable this if you use something else to balance teams.
// Default: "1"
zr_roundend_balance_teams "1"
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Account (module) // Account (module)

View File

@ -95,6 +95,7 @@ enum CvarsList
Handle:CVAR_ROUNDEND_OVERLAY, Handle:CVAR_ROUNDEND_OVERLAY,
Handle:CVAR_ROUNDEND_OVERLAY_ZOMBIE, Handle:CVAR_ROUNDEND_OVERLAY_ZOMBIE,
Handle:CVAR_ROUNDEND_OVERLAY_HUMAN, Handle:CVAR_ROUNDEND_OVERLAY_HUMAN,
Handle:CVAR_ROUNDEND_BALANCE_TEAMS,
Handle:CVAR_INFECT_SPAWNTIME_MIN, Handle:CVAR_INFECT_SPAWNTIME_MIN,
Handle:CVAR_INFECT_SPAWNTIME_MAX, Handle:CVAR_INFECT_SPAWNTIME_MAX,
Handle:CVAR_INFECT_CONSECUTIVE_BLOCK, Handle:CVAR_INFECT_CONSECUTIVE_BLOCK,
@ -369,6 +370,7 @@ CvarsCreate()
g_hCvarsList[CVAR_ROUNDEND_OVERLAY] = CreateConVar("zr_roundend_overlay", "1", "Show specified overlay to players depending on winner when the round ends."); g_hCvarsList[CVAR_ROUNDEND_OVERLAY] = CreateConVar("zr_roundend_overlay", "1", "Show specified overlay to players depending on winner when the round ends.");
g_hCvarsList[CVAR_ROUNDEND_OVERLAY_HUMAN] = CreateConVar("zr_roundend_overlays_human", "overlays/zr/humans_win", "Overlay, relative to \"materials\" folder, to display when humans win the round. [Dependency: zr_roundend_overlay]"); g_hCvarsList[CVAR_ROUNDEND_OVERLAY_HUMAN] = CreateConVar("zr_roundend_overlays_human", "overlays/zr/humans_win", "Overlay, relative to \"materials\" folder, to display when humans win the round. [Dependency: zr_roundend_overlay]");
g_hCvarsList[CVAR_ROUNDEND_OVERLAY_ZOMBIE] = CreateConVar("zr_roundend_overlays_zombie", "overlays/zr/zombies_win", "Overlay, relative to \"materials\" folder, to display when zombies win the round. [Dependency: zr_roundend_overlay]"); g_hCvarsList[CVAR_ROUNDEND_OVERLAY_ZOMBIE] = CreateConVar("zr_roundend_overlays_zombie", "overlays/zr/zombies_win", "Overlay, relative to \"materials\" folder, to display when zombies win the round. [Dependency: zr_roundend_overlay]");
g_hCvarsList[CVAR_ROUNDEND_BALANCE_TEAMS] = CreateConVar("zr_roundend_balance_teams", "1", "Balances the team every time the round ends. Disable this if you use something else to balance teams.");
// =========================== // ===========================

View File

@ -78,9 +78,10 @@ new bool:bInfectImmune[MAXPLAYERS + 1][2];
*/ */
InfectOnMapStart() InfectOnMapStart()
{ {
// Stop timers if running. // Reset timer handles. Infect timers are invalidated on a map change if
ZREndTimer(tInfect); // they are still running, so these handles no longer point to valid timers.
ZREndTimer(tInfectCountdown); tInfect = INVALID_HANDLE;
tInfectCountdown = INVALID_HANDLE;
} }
/** /**
@ -378,7 +379,7 @@ InfectOnRoundFreezeEnd()
// Check cvar and start a countdown timer if enabled. // Check cvar and start a countdown timer if enabled.
new bool:countdown = GetConVarBool(g_hCvarsList[CVAR_INFECT_MZOMBIE_COUNTDOWN]); new bool:countdown = GetConVarBool(g_hCvarsList[CVAR_INFECT_MZOMBIE_COUNTDOWN]);
if (countdown) if (countdown && randomtime > 1.0)
{ {
// Store the time until infection, and initialize the counter. // Store the time until infection, and initialize the counter.
new Handle:hCountdownData = CreateDataPack(); new Handle:hCountdownData = CreateDataPack();

View File

@ -185,8 +185,11 @@ RoundEndOnRoundEnd(reason)
// Display the overlay to all clients. // Display the overlay to all clients.
RoundEndOverlayStart(outcome); RoundEndOverlayStart(outcome);
// Balance teams. // Balance teams if enabled.
RoundEndBalanceTeams(); if (GetConVarBool(g_hCvarsList[CVAR_ROUNDEND_BALANCE_TEAMS]))
{
RoundEndBalanceTeams();
}
} }
/** /**
@ -327,9 +330,7 @@ RoundEndTerminateRound(Float:delay, RoundEndOutcome:outcome = Restart)
} }
/** /**
* Balances teams * Balances teams.
*
* @param spawn If true, it will respawn player after switching their team.
*/ */
RoundEndBalanceTeams() RoundEndBalanceTeams()
{ {