Skip to content

Commit 83acdf3

Browse files
notkoenVauff
andauthored
Feat: add classic spawn warning message (#363)
* Feat: add spawn warning message * Feat: add warning to hud * Remove unneeded variable * Change default value of convar * Adjust formatting --------- Co-authored-by: Vauff <mctehkitti@gmail.com>
1 parent 08ffd17 commit 83acdf3

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

cfg/cs2fixes/cs2fixes.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ zr_knockback_scale 5.0 // Global knockback scale
9595
zr_ztele_max_distance 150.0 // Maximum distance players are allowed to move after starting ztele
9696
zr_ztele_allow_humans 0 // Whether to allow humans to use ztele
9797
zr_infect_spawn_type 1 // Type of Mother Zombies Spawn [0 = MZ spawn where they stand, 1 = MZ get teleported back to spawn on being picked]
98+
zr_infect_spawn_warning 1 // Whether to warn players of zombies spawning between humans
9899
zr_infect_spawn_time_min 15 // Minimum time in which Mother Zombies should be picked, after round start
99100
zr_infect_spawn_time_max 15 // Maximum time in which Mother Zombies should be picked, after round start
100101
zr_infect_spawn_mz_ratio 7 // Ratio of all Players to Mother Zombies to be spawned at round start

src/zombiereborn.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ CConVar<float> g_cvarMaxZteleDistance("zr_ztele_max_distance", FCVAR_NONE, "Maxi
7777
CConVar<bool> g_cvarZteleHuman("zr_ztele_allow_humans", FCVAR_NONE, "Whether to allow humans to use ztele", false);
7878
CConVar<float> g_cvarKnockbackScale("zr_knockback_scale", FCVAR_NONE, "Global knockback scale", 5.0f);
7979
CConVar<int> g_cvarInfectSpawnType("zr_infect_spawn_type", FCVAR_NONE, "Type of Mother Zombies Spawn [0 = MZ spawn where they stand, 1 = MZ get teleported back to spawn on being picked]", (int)EZRSpawnType::RESPAWN, true, 0, true, 1);
80+
CConVar<bool> g_cvarInfectSpawnWarning("zr_infect_spawn_warning", FCVAR_NONE, "Whether to warn players of zombies spawning between humans", true);
8081
CConVar<int> g_cvarInfectSpawnTimeMin("zr_infect_spawn_time_min", FCVAR_NONE, "Minimum time in which Mother Zombies should be picked, after round start", 15, true, 0, false, 0);
8182
CConVar<int> g_cvarInfectSpawnTimeMax("zr_infect_spawn_time_max", FCVAR_NONE, "Maximum time in which Mother Zombies should be picked, after round start", 15, true, 1, false, 0);
8283
CConVar<int> g_cvarInfectSpawnMZRatio("zr_infect_spawn_mz_ratio", FCVAR_NONE, "Ratio of all Players to Mother Zombies to be spawned at round start", 7, true, 1, true, 64);
@@ -1009,6 +1010,8 @@ void SetupCTeams()
10091010
void ZR_OnRoundStart(IGameEvent* pEvent)
10101011
{
10111012
ClientPrintAll(HUD_PRINTTALK, ZR_PREFIX "The game is \x05Humans vs. Zombies\x01, the goal for zombies is to infect all humans by knifing them.");
1013+
if (g_cvarInfectSpawnWarning.Get() && g_cvarInfectSpawnType.Get() == (int)EZRSpawnType::IN_PLACE)
1014+
ClientPrintAll(HUD_PRINTTALK, ZR_PREFIX "Classic spawn is enabled! Zombies will be \x07spawning between humans\x01!");
10121015
SetupRespawnToggler();
10131016
CZRRegenTimer::RemoveAllTimers();
10141017

@@ -1459,7 +1462,14 @@ void ZR_StartInitialCountdown()
14591462

14601463
if (g_iInfectionCountDown <= 60)
14611464
{
1462-
SendHudMessageAll(2, 2, "First infection in <span color='#00FF00'>%i %s</span>!", g_iInfectionCountDown, g_iInfectionCountDown == 1 ? "second" : "seconds");
1465+
char classicSpawnMsg[256];
1466+
1467+
if (g_cvarInfectSpawnWarning.Get() && g_cvarInfectSpawnType.Get() == (int)EZRSpawnType::IN_PLACE)
1468+
V_snprintf(classicSpawnMsg, sizeof(classicSpawnMsg), "<span color='#940000'>WARNING: </span><span color='#FF3333'>Zombies will spawn between humans!</span><br><br>");
1469+
else
1470+
V_snprintf(classicSpawnMsg, sizeof(classicSpawnMsg), "");
1471+
1472+
SendHudMessageAll(2, 2, "%sFirst infection in <span color='#00FF00'>%i %s</span>!", classicSpawnMsg, g_iInfectionCountDown, g_iInfectionCountDown == 1 ? "second" : "seconds");
14631473

14641474
if (g_iInfectionCountDown % 5 == 0)
14651475
ClientPrintAll(HUD_PRINTTALK, "%sFirst infection in \7%i %s\1!", ZR_PREFIX, g_iInfectionCountDown, g_iInfectionCountDown == 1 ? "second" : "seconds");

0 commit comments

Comments
 (0)