Подписывайтесь на наш Telegram и не пропускайте важные новости! Перейти

Вопрос Проблема weapon on ground

Начинающий
Начинающий
Статус
Оффлайн
Регистрация
29 Дек 2025
Сообщения
3
Реакции
0
Код работает, но в рандомных точках карты рисуется куча обьектов, какую проверку нужно добавить что бы исправить это
C++:
Expand Collapse Copy
if (cfg.espDroppedWeapons) {
    for (int i = 65; i < 1024; i++) {
      
        uintptr_t listEntry = mem.Read<uintptr_t>(entList + 8 * ((i & 0x7FFF) >> 9) + 16);
        if (!listEntry) continue;

        
        uintptr_t entity = mem.Read<uintptr_t>(listEntry + 112 * (i & 0x1FF));
        if (!entity) continue;

      
        uintptr_t itemInfo = mem.Read<uintptr_t>(entity + offsets::m_pEntity);
        if (!itemInfo) continue;

        uintptr_t designerNamePtr = mem.Read<uintptr_t>(itemInfo + offsets::m_designerName);
        if (!designerNamePtr) continue;

        char designerName[128]{};
        ReadProcessMemory(mem.hProc, (LPCVOID)designerNamePtr, designerName, sizeof(designerName) - 1, NULL);

        if (strstr(designerName, "weapon_") || strstr(designerName, "baseanimgraph") || strstr(designerName, "item_defuser")) {

            
            uint16_t wId = mem.Read<uint16_t>(entity + offsets::m_AttributeManager + offsets::m_Item + offsets::m_iItemDefinitionIndex);

            
          

            uintptr_t sceneNode = mem.Read<uintptr_t>(entity + offsets::m_pGameSceneNode);
            if (!sceneNode) continue;

            Vector3 origin = mem.Read<Vector3>(sceneNode + offsets::m_vecOrigin);

        
            float dist = sqrtf(pow(origin.x - localPos.x, 2) + pow(origin.y - localPos.y, 2) + pow(origin.z - localPos.z, 2));

            
            if (dist < 1.0f || dist > cfg.droppedWeaponDist) continue;

            Vector2 screenPos;
            if (WorldToScreen(origin, screenPos, vMat)) {

                const char* icon = GetWeaponIcon(wId);

                if (icon && icon[0] != ' ' && iconFont) {
                    ImGui::PushFont(iconFont);

                    float fontSize = cfg.droppedWeaponIconSize;
                    ImVec2 tSize = iconFont->CalcTextSizeA(fontSize, FLT_MAX, 0.0f, icon);
                    ImVec2 iconPos = ImVec2(screenPos.x - (tSize.x / 2.0f), screenPos.y);

                    
                    ImU32 col = ImGui::ColorConvertFloat4ToU32(*(ImVec4*)cfg.colDroppedWeapon);
                    ImU32 shadowCol = IM_COL32(0, 0, 0, (int)(cfg.colDroppedWeapon[3] * 255));

                    
                    draw->AddText(iconFont, fontSize, ImVec2(iconPos.x + 1, iconPos.y + 1), shadowCol, icon);
                    draw->AddText(iconFont, fontSize, iconPos, col, icon);
                    ImGui::PopFont();

                  
                    char dBuf[32];
                    sprintf_s(dBuf, "[%.0fm]", dist * 0.0254f);
                    ImVec2 dSize = ImGui::CalcTextSize(dBuf);
                    draw->AddText(ImVec2(screenPos.x - dSize.x / 2, screenPos.y + tSize.y + 2), IM_COL32(255, 255, 255, 200), dBuf);
                }
            }
        }
    }
}
 
Назад
Сверху Снизу