Вопрос ESP Preview lw v3?

shhhhitttt
Начинающий
Статус
Оффлайн
Регистрация
19 Дек 2020
Сообщения
65
Реакции[?]
10
Поинты[?]
0
Всем доброго времени суток!
У меня есть данный код:
main.h
C++:
enum esp_info_position
{
    RIGHT,
    CENTER_DOWN,
    CENTER_UP
};

struct esp_info_s
{
    esp_info_s(const std::string name, const ImColor color, const int position = RIGHT)
    {
        f_name = name; f_color = color; f_position = position;
    }
    std::string f_name;
    int f_position;
    ImColor f_color;
};
main.cpp
C++:
void esp_preview
{
static std::vector<esp_info_s> info;

    static bool enabled = true;
    ImGui::SetNextWindowSize(ImVec2(280, 430));
    //ffs i dont find showborder here maybe u can find it on old imgui or i dont know where it is
    ImGui::Begin("ESP Preview", &enabled, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse );
    {
        auto cur_window = ImGui::GetCurrentWindow();
        ImVec2 w_pos = cur_window->Pos;
        if (g_cfg.player.type->box)
        {
            //clear shit box
                cur_window->DrawList->AddRect(ImVec2(w_pos.x + 40, w_pos.y + 60), ImVec2(w_pos.x + 200, w_pos.y + 360), ImColor(g_cfg.player.type->box_color[0] * 255, g_cfg.player.type->box_color[1] * 255, g_cfg.player.type->box_color[2] * 255));//getrawcolor???
        }
        if (g_cfg.player.type->health)
        {
            cur_window->DrawList->AddRectFilled(ImVec2(w_pos.x + 34, w_pos.y + 60), ImVec2(w_pos.x + 37, w_pos.y + 360), ImColor(255,255,255,255));//change this to green value im lazy to look hex color
        }
        if (g_cfg.player.type->name)
            info.emplace_back(esp_info_s("name", ImColor(255,255,255,255), CENTER_UP));

        for (auto render : info)
        {
            auto text_size = ImGui::CalcTextSize(render.f_name.c_str());
            auto pos = ImVec2(w_pos.x + 205, w_pos.y + 60);
            if (render.f_position == CENTER_DOWN)
            {
                pos = ImVec2(w_pos.x + (240 / 2) - text_size.x / 2, pos.y + 315 - text_size.y);
            }
            else if (render.f_position == CENTER_UP)
            {
                pos = ImVec2(w_pos.x + (240 / 2) - text_size.x / 2, pos.y - 5 - text_size.y);
            }
            cur_window->DrawList->AddText(pos, render.f_color, render.f_name.c_str());//still no u32 ;D
        }
    }
    }
Но почему-то, когда я вызываю эту функцию, у меня крашит CS:GO, если не сложно - прошу о помощи :)
 
Участник
Статус
Оффлайн
Регистрация
16 Июн 2017
Сообщения
826
Реакции[?]
181
Поинты[?]
2K
бегин закончи
 
shhhhitttt
Начинающий
Статус
Оффлайн
Регистрация
19 Дек 2020
Сообщения
65
Реакции[?]
10
Поинты[?]
0
Так чтоль? Я просто еблан, не знаю :)

C++:
void esp_preview
{
    static std::vector<esp_info_s> info;

    static bool enabled = true;
    ImGui::SetNextWindowSize(ImVec2(280, 430));
    //ffs i dont find showborder here maybe u can find it on old imgui or i dont know where it is
    ImGui::Begin("ESP Preview", &enabled, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse );
    {
        auto cur_window = ImGui::GetCurrentWindow();
        ImVec2 w_pos = cur_window->Pos;
        if (g_cfg.player.type->box)
        {
            //clear shit box
                cur_window->DrawList->AddRect(ImVec2(w_pos.x + 40, w_pos.y + 60), ImVec2(w_pos.x + 200, w_pos.y + 360), ImColor(g_cfg.player.type->box_color[0] * 255, g_cfg.player.type->box_color[1] * 255, g_cfg.player.type->box_color[2] * 255));//getrawcolor???
        }
        if (g_cfg.player.type->health)
        {
            cur_window->DrawList->AddRectFilled(ImVec2(w_pos.x + 34, w_pos.y + 60), ImVec2(w_pos.x + 37, w_pos.y + 360), ImColor(255,255,255,255));//change this to green value im lazy to look hex color
        }
        if (g_cfg.player.type->name)
            info.emplace_back(esp_info_s("name", ImColor(255,255,255,255), CENTER_UP));

        for (auto render : info)
        {
            auto text_size = ImGui::CalcTextSize(render.f_name.c_str());
            auto pos = ImVec2(w_pos.x + 205, w_pos.y + 60);
            if (render.f_position == CENTER_DOWN)
            {
                pos = ImVec2(w_pos.x + (240 / 2) - text_size.x / 2, pos.y + 315 - text_size.y);
            }
            else if (render.f_position == CENTER_UP)
            {
                pos = ImVec2(w_pos.x + (240 / 2) - text_size.x / 2, pos.y - 5 - text_size.y);
            }
            cur_window->DrawList->AddText(pos, render.f_color, render.f_name.c_str());//still no u32 ;D
        }
    }
    ImGui::End();
    info.clear();
}
}
 
Участник
Статус
Оффлайн
Регистрация
16 Июн 2017
Сообщения
826
Реакции[?]
181
Поинты[?]
2K
Сверху Снизу