Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions src/zombiereborn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ static bool g_bRespawnEnabled = true;
static CHandle<CBaseEntity> g_hRespawnToggler;
static CHandle<CTeam> g_hTeamCT;
static CHandle<CTeam> g_hTeamT;
std::vector<ZEPlayerHandle> g_MotherZombies;

CZRPlayerClassManager* g_pZRPlayerClassManager = nullptr;
ZRWeaponConfig* g_pZRWeaponConfig = nullptr;
Expand Down Expand Up @@ -911,6 +912,8 @@ void ZR_OnRoundPrestart(IGameEvent* pEvent)
if (pPawn)
pPawn->m_bTakesDamage = false;
}

g_MotherZombies.clear();
}

void SetupRespawnToggler()
Expand Down Expand Up @@ -1258,6 +1261,8 @@ void ZR_InfectMotherZombie(CCSPlayerController* pVictimController, std::vector<S

ZEPlayerHandle hPlayer = pZEPlayer->GetHandle();
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
Expand Down Expand Up @@ -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());
}
Loading