Spectator List

Lynph

Newbie
Newbie
Newbie
Newbie
Status
Offline
Joined
Jun 6, 2019
Messages
6
Reaction score
5
C++:
void Misc::SpectatorList()
{
    if (!g_EngineClient->IsInGame() || !g_LocalPlayer)
        return;

    std::string spectators;

    for (int i = 0; i < g_EngineClient->GetMaxClients(); i++)
    {
        C_BasePlayer* entity = C_BasePlayer::GetPlayerByIndex(i);

        if (!entity)
            continue;

        if (entity->IsAlive())
            continue;

        if (entity->IsDormant())
            continue;

        if (!entity->m_hObserverTarget())
            continue;

        C_BasePlayer* target = entity->m_hObserverTarget();

        if (!target->IsPlayer())
            continue;

        player_info_t entityinfo = entity->GetPlayerInfo();
        player_info_t targetinfo = target->GetPlayerInfo();

        spectators += std::string(entityinfo.szName) + " > " + targetinfo.szName + "\n";
    }

    auto size = Menu::Get().globalFont->CalcTextSizeA(16.f, FLT_MAX, NULL, spectators.c_str()); // 16 font pixels for change your Menu::Get().globalFont for your font

    ImGui::SetNextWindowSize(ImVec2(300, size.y + 40.f));
    if (ImGui::Begin("Spectator List", NULL, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse))
    {
        ImGui::Text(spectators.c_str());
        ImGui::End();
    }
}
Credits: YG
 

Khainaaeh

кто прочитал тот здохнет
User
кто прочитал тот здохнет
User
Status
Offline
Joined
Jul 14, 2019
Messages
36
Reaction score
15
Top