if (!bNameUnlocked)
{
ConVar* pName = Cvar->FindVar("name");
pName->fnChangeCallback = NULL;
bNameUnlocked = true;
}
bool bDidMeme = false;
int iNameIndex = -1;
char chCommand[50];
for (int iPlayerIndex = 0; iPlayerIndex < Engine->GetMaxClients(); iPlayerIndex++)
{
CBaseEntity* pEntity = (CBaseEntity*)ClientEntList->GetClientEntity(iPlayerIndex);
if (!pEntity || pEntity == Global::LocalPlayer || iPlayerIndex == Engine->GetLocalPlayer() || Global::LocalPlayer->GetTeam() != pEntity->GetTeam())
continue;
if (rand() % 3 == 1)
{
iNameIndex = pEntity->index;
bDidMeme = true;
}
}
if (bDidMeme)
{
player_info_t pInfo;
Engine->GetPlayerInfo(iNameIndex, &pInfo);
sprintf(chCommand, "name \"%s \"", pInfo.name);
}
if (!bDidMeme)
return;
Engine->ExecuteClientCmd(chCommand);