diff --git a/src/zombiereborn.cpp b/src/zombiereborn.cpp index 00de8278..885b7e81 100644 --- a/src/zombiereborn.cpp +++ b/src/zombiereborn.cpp @@ -56,6 +56,7 @@ static bool g_bRespawnEnabled = true; static CHandle g_hRespawnToggler; static CHandle g_hTeamCT; static CHandle g_hTeamT; +std::vector g_MotherZombies; CZRPlayerClassManager* g_pZRPlayerClassManager = nullptr; ZRWeaponConfig* g_pZRWeaponConfig = nullptr; @@ -911,6 +912,8 @@ void ZR_OnRoundPrestart(IGameEvent* pEvent) if (pPawn) pPawn->m_bTakesDamage = false; } + + g_MotherZombies.clear(); } void SetupRespawnToggler() @@ -1258,6 +1261,8 @@ void ZR_InfectMotherZombie(CCSPlayerController* pVictimController, std::vectorGetHandle(); CTimer::Create(rand() % (int)g_cvarMoanInterval.Get(), TIMERFLAG_MAP | TIMERFLAG_ROUND, [hPlayer]() { return ZR_MoanTimer(hPlayer); }); + + g_MotherZombies.push_back(hPlayer); } // make players who've been picked as MZ recently less likely to be picked again @@ -2073,4 +2078,43 @@ CON_COMMAND_CHAT_FLAGS(revive, "- Revive a player", ADMFLAG_GENERIC) } if (iNumClients > 1) PrintMultiAdminAction(nType, strCommandPlayerName, "revived", "", ZR_PREFIX); +} + +CON_COMMAND_CHAT(motherzombies, "- Print the current mother zombies to chat") +{ + if (g_ZRRoundState == EZRRoundState::ROUND_START || g_MotherZombies.size() == 0) + { + ClientPrint(player, HUD_PRINTTALK, ZR_PREFIX "There are no mother zombies."); + return; + } + + bool first = true; + std::string names = ""; + for (int i = g_MotherZombies.size() - 1; i >= 0; i--) + { + if (!g_MotherZombies[i].IsValid()) + { + g_MotherZombies.erase(g_MotherZombies.begin() + i); + continue; + } + + CCSPlayerController* pMZ = CCSPlayerController::FromSlot(g_MotherZombies[i].GetPlayerSlot()); + if (!pMZ) + continue; + + if (first) + { + names = pMZ->GetPlayerName(); + first = false; + } + else + { + names += ", " + pMZ->GetPlayerName(); + } + } + + if (first) + ClientPrint(player, HUD_PRINTTALK, ZR_PREFIX "There are no mother zombies."); + else + ClientPrint(player, HUD_PRINTTALK, ZR_PREFIX "Mother zombies: %s", names.c_str()); } \ No newline at end of file