сосиска джем
-
Автор темы
- #1
Код не мой, нашёл на просторах Тырнетов. Решил поделиться с вами...
Код:
void DrawingSpectatorList()
{
int specs = 0;
int modes = 0;
std::string spect = "";
std::string mode = "";
if (g_EngineClient->IsInGame() && g_EngineClient->IsConnected())
{
int localIndex = g_EngineClient->GetLocalPlayer();
C_BasePlayer* pLocalEntity = C_BasePlayer::GetPlayerByIndex(localIndex);
if (pLocalEntity)
{
for (int i = 0; i < g_EngineClient->GetMaxClients(); i++)
{
C_BasePlayer* pBaseEntity = C_BasePlayer::GetPlayerByIndex(i);
if (!pBaseEntity)
continue;
if (pBaseEntity->m_iHealth() > 0)
continue;
if (pBaseEntity == pLocalEntity)
continue;
if (pBaseEntity->IsDormant())
continue;
if (pBaseEntity->m_hObserverTarget() != pLocalEntity)
continue;
player_info_t pInfo;
g_EngineClient->GetPlayerInfo(pBaseEntity->EntIndex(), &pInfo);
if (pInfo.ishltv)
continue;
spect += pInfo.szName;
spect += "\n";
specs++;
switch (*pBaseEntity->GetObserverMode())
{
case OBS_MODE_IN_EYE:
mode += "Perspective";
break;
case OBS_MODE_CHASE:
mode += "3rd Person";
break;
case OBS_MODE_ROAMING:
mode += "No Clip";
break;
case OBS_MODE_DEATHCAM:
mode += "Deathcam";
break;
case OBS_MODE_FREEZECAM:
mode += "Freezecam";
break;
case OBS_MODE_FIXED:
mode += "Fixed";
break;
default:
break;
}
mode += "\n";
modes++;
}
}
}
if (ImGui::Begin("Spectator List", &g_Options.esp_spec_list, ImVec2(0, 0), 0.4F, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_ShowBorders))
{
if (specs > 0) spect += "\n";
if (modes > 0) mode += "\n";
ImVec2 size = ImGui::CalcTextSize(spect.c_str());
ImGui::SetWindowSize(ImVec2(200, 15 + size.y));
ImGui::Columns(2);
ImGui::Separator();
ImGui::Text("Name");
ImGui::NextColumn();
ImGui::Text("Mode");
ImGui::NextColumn();
ImGui::Separator();
ImGui::Text(spect.c_str());
ImGui::NextColumn();
ImGui::Text(mode.c_str());
ImGui::Columns(1);
ImGui::Separator();
}
ImGui::End();
}