Skip to content

Instantly share code, notes, and snippets.

@markhc
Created May 13, 2016 09:03
Show Gist options
  • Save markhc/7ae8862b940ffa9462461b430abe2984 to your computer and use it in GitHub Desktop.
Save markhc/7ae8862b940ffa9462461b430abe2984 to your computer and use it in GitHub Desktop.
static int times = 0;
if(g_Options.MiscHideName) {
static SourceSDK::ConVar* name = SourceSDK::Interfaces::CVar()->FindVar("name");
*reinterpret_cast<int*>(reinterpret_cast<DWORD>(&name->m_fnChangeCallbacks) + 0xC) = 0;
if(times < 50) {
static string szName = "\n";
if(szName[0] == '\n') {
for(int i = 1; i < SourceSDK::Interfaces::EngineClient()->GetMaxClients(); i++) {
auto pEntity = static_cast<C_CSPlayer*>(SourceSDK::Interfaces::EntityList()->GetClientEntity(i));
SourceSDK::player_info_t info;
if(pEntity &&
pEntity->GetTeamNum() == pLocalPlayer->GetTeamNum() &&
pLocal->EntIndex() != i &&
SourceSDK::Interfaces::EngineClient()->GetPlayerInfo(pEntity->EntIndex(), &info)) {
szName = "\n"s + info.szName;
}
}
}
name->SetValue(szName.data());
times++;
} else { //Done
g_Options.MiscHideName = false;
g_Options.MiscNameHidden = true;
}
} else {
times = 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment