Вопрос Spectator list crashing the game (CSGOsimple)

Начинающий
Статус
Оффлайн
Регистрация
7 Авг 2020
Сообщения
38
Реакции[?]
0
Поинты[?]
0
when I turn on the spectator list and then drag the menu to the corner of the screen, my game crashes out of nowhere. I don't know how to solve this
 
// removed because antipasta
Забаненный
Статус
Оффлайн
Регистрация
10 Сен 2018
Сообщения
312
Реакции[?]
145
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
use debug
 
Начинающий
Статус
Оффлайн
Регистрация
7 Авг 2020
Сообщения
38
Реакции[?]
0
Поинты[?]
0
[QUOTE = "underrated, post: 1807033, member: 91346"]
use debug
[/ QUOTE]
in debug mode my game is crash
[QUOTE = "halabiba, post: 1807030, member: 414450"]
give me source
[/ QUOTE]

pass me ur dc
 
EVOLUTION ?
Забаненный
Статус
Оффлайн
Регистрация
30 Июл 2019
Сообщения
1,162
Реакции[?]
269
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Начинающий
Статус
Оффлайн
Регистрация
7 Авг 2020
Сообщения
38
Реакции[?]
0
Поинты[?]
0
std::list<int> GetObservervators(int playerId)
{
std::list<int> list;

if (!g_EngineClient->IsInGame())
return list;

C_BasePlayer* player = (C_BasePlayer*)g_EntityList->GetClientEntity(playerId);
if (!player)
return list;

if (!player->IsAlive())
{
C_BasePlayer* observerTarget = (C_BasePlayer*)g_EntityList->GetClientEntityFromHandle(player->m_hObserverTarget());
if (!observerTarget)
return list;

player = observerTarget;
}

for (int i = 1; i < g_EngineClient->GetMaxClients(); i++)
{
C_BasePlayer* pPlayer = (C_BasePlayer*)g_EntityList->GetClientEntity(i);
if (!pPlayer)
continue;

if (pPlayer->IsDormant() || pPlayer->IsAlive())
continue;

C_BasePlayer* target = (C_BasePlayer*)g_EntityList->GetClientEntityFromHandle(pPlayer->m_hObserverTarget());
if (player != target)
continue;

list.push_back(i);
}

return list;
}
//--------------------------------------------------------------------------------
void Visuals::RenderSpectatorList() {

int specs = 0;
std::string spect = "";

if (g_EngineClient->IsInGame() && g_EngineClient->IsConnected()) {
int localIndex = g_EngineClient->GetLocalPlayer();
C_BasePlayer* pLocalEntity = C_BasePlayer::GetPlayerByIndex(localIndex);
if (pLocalEntity) {
for (int i = 1; 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 (! pLocalEntity-> IsAlive ()) {
if (pBaseEntity-> m_hObserverTarget ()! = pLocalEntity-> m_hObserverTarget ())
continue;
}
else {
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 ++;
}
}
}

ImGui :: PushStyleVar (ImGuiStyleVar_WindowTitleAlign, ImVec2 (0.5f, 0.5f));
if (ImGui :: Begin ("spectators", nullptr, ImVec2 (0, 0), 0.9f, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar)) {


ImGui :: Separator ();

if (specs> 0) spect + = "\ n";

ImVec2 size = ImGui :: CalcTextSize (spect.c_str ());
ImGui :: SetWindowSize (ImVec2 (200, 25 + size.y));
ImGui :: Text (spect.c_str ());
}
ImGui :: End ();
ImGui :: PopStyleVar ();
}
 
EVOLUTION ?
Забаненный
Статус
Оффлайн
Регистрация
30 Июл 2019
Сообщения
1,162
Реакции[?]
269
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Try this:
C++:
void Visuals::RenderSpectatorList() {
    int specs = 0;
    std::string spect = "";

    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++;
            }
        }
    }
    ImGui::PushStyleVar(ImGuiStyleVar_WindowTitleAlign, ImVec2(0.5f, 0.5f));
    if (ImGui::Begin("Spectator List", nullptr, ImVec2(0, 0), 0.4F, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar)) {
        if (specs > 0) spect += "\n";

        ImVec2 size = ImGui::CalcTextSize(spect.c_str());
        ImGui::SetWindowSize(ImVec2(200, 25 + size.y));
        ImGui::Text(spect.c_str());
    }
    ImGui::End();
    ImGui::PopStyleVar();
}
 
Сверху Снизу