Вопрос Проблемы с esp

Начинающий
Начинающий
Статус
Оффлайн
Регистрация
2 Июн 2025
Сообщения
11
Реакции
1
esp.cpp:
Expand Collapse Copy
#include "include.h"
#include "esp.h"
#include "window/window.h"
#include <cstdio>

namespace ESP {
    std::vector<PlayerESP> playerList;
    std::mutex espMutex;
    int debugFoundEntities = 0;
    
    Vector3 GetEntityPosition(uintptr_t entity) {
        uintptr_t gameSceneNode = VARS::memRead<uintptr_t>(entity + offsets::m_pGameSceneNode);
        if (gameSceneNode) {
            Vector3 origin = VARS::memRead<Vector3>(gameSceneNode + offsets::m_vecAbsOrigin);
            if (origin.x != 0 || origin.y != 0 || origin.z != 0) {
                return origin;
            }
        }
        
        Vector3 oldOrigin = VARS::memRead<Vector3>(entity + offsets::m_vOldOrigin);
        return oldOrigin;
    }

    void DrawBox(const Vector3& top, const Vector3& bottom, int health) {
        float height = bottom.y - top.y;
        float width = height / 2.0f;

        ImColor color;
        if (health > 75)
            color = ImColor(0, 255, 0, 255);
        else if (health > 50)
            color = ImColor(255, 255, 0, 255);
        else if (health > 25)
            color = ImColor(255, 165, 0, 255);
        else
            color = ImColor(255, 0, 0, 255);

        ImGui::GetBackgroundDrawList()->AddRect(
            ImVec2(top.x - width / 2, top.y),
            ImVec2(top.x + width / 2, bottom.y),
            color,
            0.0f,
            0,
            2.0f
        );
    }

    void DrawHealthBar(const Vector3& top, const Vector3& bottom, int health) {
        float height = bottom.y - top.y;
        float width = height / 2.0f;

        float barHeight = (height * health) / 100.0f;
        
        ImGui::GetBackgroundDrawList()->AddRectFilled(
            ImVec2(top.x - width / 2 - 7, top.y),
            ImVec2(top.x - width / 2 - 2, bottom.y),
            ImColor(0, 0, 0, 150)
        );

        ImColor healthColor;
        if (health > 75)
            healthColor = ImColor(0, 255, 0, 255);
        else if (health > 50)
            healthColor = ImColor(255, 255, 0, 255);
        else if (health > 25)
            healthColor = ImColor(255, 165, 0, 255);
        else
            healthColor = ImColor(255, 0, 0, 255);

        ImGui::GetBackgroundDrawList()->AddRectFilled(
            ImVec2(top.x - width / 2 - 7, bottom.y - barHeight),
            ImVec2(top.x - width / 2 - 2, bottom.y),
            healthColor
        );
    }

    void RenderESP() {
        std::lock_guard<std::mutex> lock(espMutex);
        
        char debugText[256];
        sprintf_s(debugText, "Found: %d | Rendered: %d | Client: %s",
            debugFoundEntities,
            (int)playerList.size(),
            (globals::clientAddress != 0) ? "OK" : "FAIL"
        );
        ImGui::GetBackgroundDrawList()->AddText(
            ImVec2(10, 10),
            ImColor(0, 255, 0, 255),
            debugText
        );
        
        for (const auto& player : playerList) {
            DrawBox(player.screenHead, player.screenFeet, player.health);
            DrawHealthBar(player.screenHead, player.screenFeet, player.health);
        }
    }
}

hacks.cpp:
Expand Collapse Copy
#include "include.h"
#include "hacks.h"
#include "window/window.h"
#include "esp.h"
#include <mutex>
#include <cmath>

namespace hacks {
void AimBotThread(const Mem& mem) noexcept {
    while (true) {
        std::this_thread::sleep_for(std::chrono::milliseconds(16));
    }
}
void ESPThread(const Mem& mem) noexcept {
    while (true) {
        std::this_thread::sleep_for(std::chrono::milliseconds(1));
        
        if (!globals::ESP) {
            continue;
        }

        try {
            std::vector<ESP::PlayerESP> tempList;
            int foundEntities = 0;

            // Read ViewMatrix for W2S conversion
            view_matrix_t viewMatrix = VARS::memRead<view_matrix_t>(globals::clientAddress + offsets::dwViewMatrix);

            // Read local player pawn
            uintptr_t localPlayerPawn = VARS::memRead<uintptr_t>(globals::clientAddress + offsets::dwLocalPlayerPawn);
            if (!localPlayerPawn) continue;

            // Read local player team
            int localTeam = VARS::memRead<int>(localPlayerPawn + offsets::m_iTeamNum);

            // Get EntityList address
            uintptr_t entityList = globals::clientAddress + offsets::dwEntityList;

            // Loop through all possible player slots (1-64)
            for (int i = 1; i <= 64; i++) {
                // Calculate entity list entry for this index
                // Formula: EntityList + 8 * (index / 512) + 16
                uintptr_t listEntry = VARS::memRead<uintptr_t>(entityList + 8 * (i >> 9) + 16);
                if (!listEntry) continue;

                // Get the entity (Controller) from list entry
                // Formula: ListEntry + 120 * (index % 512)
                uintptr_t controller = VARS::memRead<uintptr_t>(listEntry + 120 * (i & 0x1FF));
                if (!controller) continue;

                // Read player pawn handle from controller
                int pawnHandle = VARS::memRead<int>(controller + offsets::m_hPlayerPawn);
                if (!pawnHandle) continue;

                // Get the list entry for the pawn using the handle
                uintptr_t list2 = VARS::memRead<uintptr_t>(entityList + 0x8 * ((pawnHandle & 0x7FFF) >> 9) + 16);
                if (!list2) continue;

                // Get the actual pawn
                uintptr_t pawn = VARS::memRead<uintptr_t>(list2 + 120 * (pawnHandle & 0x1FF));
                if (!pawn) continue;
                
                // Skip local player
                if (pawn == localPlayerPawn) continue;

                // Read pawn health
                int health = VARS::memRead<int>(pawn + offsets::m_iHealth);
                if (health <= 0 || health > 100) continue;

                // Read pawn team
                int team = VARS::memRead<int>(pawn + offsets::m_iTeamNum);
                
                // Skip teammates
                if (team == localTeam) continue;
                
                // Only show valid teams (T = 2, CT = 3)
                if (team != 2 && team != 3) continue;

                foundEntities++;

                // Get game scene node for position
                uintptr_t gameSceneNode = VARS::memRead<uintptr_t>(pawn + offsets::m_pGameSceneNode);
                if (!gameSceneNode) continue;

                // Read absolute origin
                Vector3 origin = VARS::memRead<Vector3>(gameSceneNode + offsets::m_vecAbsOrigin);
                
                // Validate position
                if (origin.x == 0.0f && origin.y == 0.0f && origin.z == 0.0f) continue;

                // Calculate head and feet positions
                Vector3 headPos(origin.x, origin.y, origin.z + 75.0f);
                Vector3 feetPos(origin.x, origin.y, origin.z);

                // Convert to screen coordinates
                Vector3 screenHead = headPos.W2S(viewMatrix, globals::screenWidth, globals::screenHeight);
                Vector3 screenFeet = feetPos.W2S(viewMatrix, globals::screenWidth, globals::screenHeight);

                // Skip if behind camera
                if (screenHead.z < 0.01f) continue;

                // Add to render list
                tempList.push_back({ screenHead, screenFeet, health });
            }

            // Update shared data
            {
                std::lock_guard<std::mutex> lock(ESP::espMutex);
                ESP::playerList = tempList;
                ESP::debugFoundEntities = foundEntities;
            }
        }
        catch (...) {
            // Catch any exceptions to prevent crash
        }
    }
}
void TriggerThread(const Mem& mem) noexcept {
    while (true) {
        std::this_thread::sleep_for(std::chrono::milliseconds(16));
    }
}
void MiscThread(const Mem& mem) noexcept {
    while (true) {
        std::this_thread::sleep_for(std::chrono::milliseconds(16));
    }
}
}
чит не читает персонажей. пишет что не нашел никого. Очень нужна помошь
 
Назад
Сверху Снизу