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

Вопрос Weapon esp

Начинающий
Начинающий
Статус
Оффлайн
Регистрация
2 Ноя 2024
Сообщения
103
Реакции
12
здрасте, я хочу попросить помощь у знающих и знатаков.
я делаю свою экстернал базу, и когда сделал weapon esp на земле, появились некоторые траблы...
суть: некоторые оружия или пропы, не рисуются как пропы в есп, и просто пустой например веапон есп если на земле лежит оружие.
помогите кто чем сможет, ну пж :FeelsBadMan:
если вы не собираетесь помогать просьба не писать пж

C++:
Expand Collapse Copy
std::string get_prop_name(uintptr_t entity) const {
    if (!entity) return "";

    std::string name;
    uintptr_t item_info = memory::Read<uintptr_t>(entity + 0x10);

    if (item_info) {
        uintptr_t type_ptr = memory::Read<uintptr_t>(item_info + 0x20);
        if (type_ptr) {
            char name_buf[128]{};
            memory::ReadBytes(type_ptr, name_buf, sizeof(name_buf) - 1);
            name = name_buf;
            std::transform(name.begin(), name.end(), name.begin(), ::tolower);
        }
    }

    return name;
}

bool check_is_weapon(const std::string& name) const {
    if (name.rfind("weapon_", 0) != 0) return false;

    return name != "weapon_c4" &&
        name != "weapon_molotov" &&
        name != "weapon_flashbang" &&
        name != "weapon_hegrenade" &&
        name != "weapon_smokegrenade" &&
        name != "weapon_incgrenade" &&
        name != "weapon_decoy";
}

bool check_is_c4(const std::string& name) const {
    return name.find("c4") != std::string::npos ||
        name.find("ied") != std::string::npos ||
        name.find("bomb") != std::string::npos;
}

bool check_is_grenade(const std::string& name) const {
    return name == "weapon_molotov" ||
        name == "weapon_flashbang" ||
        name == "weapon_hegrenade" ||
        name == "weapon_smokegrenade" ||
        name == "weapon_incgrenade" ||
        name == "weapon_decoy";
}

bool check_is_projectile(const std::string& name) const {
    return name.find("_projectile") != std::string::npos;
}

std::vector<prop_t> get_props() const {
    std::vector<prop_t> props;
    if (!entity_list || !local_player) return props;

    std::unordered_map<std::string, prop_t> closest_items;
    std::unordered_map<std::string, int> coord_count;
    constexpr float EPSILON = 0.1f;

    for (int i = 1; i < 1024; ++i) {
        uintptr_t list_entry = memory::Read<uintptr_t>(entity_list + 0x8 * ((i & 0x7FFF) >> 9) + 0x10);
        if (!list_entry) continue;

        uintptr_t entity = memory::Read<uintptr_t>(list_entry + 0x70 * (i & 0x1FF));
        if (!entity || entity == local_player) continue;

        uintptr_t item_info = memory::Read<uintptr_t>(entity + 0x10);
        if (!item_info) continue;

        uintptr_t type_ptr = memory::Read<uintptr_t>(item_info + 0x20);
        if (!type_ptr) continue;

        std::string name = get_prop_name(entity);
        if (name.empty()) continue;

        uintptr_t node = memory::Read<uintptr_t>(entity + c_baseentity::m_pgamescenenode);
        if (!node) continue;

        vec3_t pos = get_entity_origin(entity);

        if (fabs(pos.x) < EPSILON && fabs(pos.y) < EPSILON && fabs(pos.z) < EPSILON) continue;

        std::string coord_key = std::to_string((int)(pos.x * 10)) + "_" +
            std::to_string((int)(pos.y * 10)) + "_" +
            std::to_string((int)(pos.z * 10));

        if (coord_count[coord_key] > 5) continue;

        coord_count[coord_key]++;

        float dx = pos.x - local_position.x;
        float dy = pos.y - local_position.y;
        float dz = pos.z - local_position.z;
        float dist_sq = dx * dx + dy * dy + dz * dz;

        if (dist_sq > 5000.0f * 5000.0f) continue;

        auto it = closest_items.find(name);
        if (it == closest_items.end() || dist_sq < it->second.distance * it->second.distance) {
            prop_t prop;
            prop.entity_address = entity;
            prop.position = pos;
            prop.name = name;
            prop.distance = std::sqrt(dist_sq);
            prop.is_weapon = check_is_weapon(name);
            prop.is_c4 = check_is_c4(name);
            prop.is_grenade = check_is_grenade(name);
            prop.is_projectile = check_is_projectile(name);
            prop.valid = true;

            closest_items[name] = prop;
        }
    }

    for (auto& item : closest_items) {
        if (fabs(item.second.position.x) > 10.0f ||
            fabs(item.second.position.y) > 10.0f ||
            fabs(item.second.position.z) > 10.0f) {
            props.push_back(item.second);
        }
    }

    std::sort(props.begin(), props.end(), [](const prop_t& a, const prop_t& b) {
        return a.distance < b.distance;
        });

    return props;
}

std::vector<prop_t> get_weapons() const {
    std::vector<prop_t> weapons;
    auto props = get_props();

    for (const auto& prop : props) {
        if (prop.is_weapon) {
            weapons.push_back(prop);
        }
    }

    return weapons;
}

std::vector<prop_t> get_grenades() const {
    std::vector<prop_t> grenades;
    auto props = get_props();

    for (const auto& prop : props) {
        if (prop.is_grenade || prop.is_projectile) {
            grenades.push_back(prop);
        }
    }

    return grenades;
}

prop_t get_c4() const {
    auto props = get_props();

    for (const auto& prop : props) {
        if (prop.is_c4) {
            return prop;
        }
    }

    return { 0, {0, 0, 0}, "", 0.0f, false, false, false, false, false };
}
 
C++:
Expand Collapse Copy
for (int i = 0; i < 2048; 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 + 0x10);
    if (!itemInfo) continue;

    uintptr_t designerNamePtr = mem.Read<uintptr_t>(itemInfo + 0x20);
    if (!designerNamePtr) continue;

    char designerName[128]{};
    mem.ReadRaw(designerNamePtr, designerName, sizeof(designerName));

    bool isProjectile = strstr(designerName, "_projectile") != nullptr;
    bool isWeapon = strstr(designerName, "weapon_") || strstr(designerName, "item_defuser") || strstr(designerName, "baseanimgraph");

    if (isProjectile && !cfg.espGrenades) continue;
    if (isWeapon && !isProjectile && !cfg.espDroppedWeapons) continue;

    if (isWeapon || isProjectile) {
        if (isWeapon && !isProjectile) {
            uint32_t owner = mem.Read<uint32_t>(entity + offsets::m_hOwnerEntity);
            if (owner != 0xFFFFFFFF) continue;
        }

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

        Vector3 origin = mem.Read<Vector3>(sceneNode + offsets::m_vecOrigin);
        if (origin.x == 0 && origin.y == 0) continue;


       
        }
Тут в перемешку с другой функцией, но я думаю поймешь
 
C++:
Expand Collapse Copy
for (int i = 0; i < 2048; 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 + 0x10);
    if (!itemInfo) continue;

    uintptr_t designerNamePtr = mem.Read<uintptr_t>(itemInfo + 0x20);
    if (!designerNamePtr) continue;

    char designerName[128]{};
    mem.ReadRaw(designerNamePtr, designerName, sizeof(designerName));

    bool isProjectile = strstr(designerName, "_projectile") != nullptr;
    bool isWeapon = strstr(designerName, "weapon_") || strstr(designerName, "item_defuser") || strstr(designerName, "baseanimgraph");

    if (isProjectile && !cfg.espGrenades) continue;
    if (isWeapon && !isProjectile && !cfg.espDroppedWeapons) continue;

    if (isWeapon || isProjectile) {
        if (isWeapon && !isProjectile) {
            uint32_t owner = mem.Read<uint32_t>(entity + offsets::m_hOwnerEntity);
            if (owner != 0xFFFFFFFF) continue;
        }

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

        Vector3 origin = mem.Read<Vector3>(sceneNode + offsets::m_vecOrigin);
        if (origin.x == 0 && origin.y == 0) continue;


      
        }
Тут в перемешку с другой функцией, но я думаю поймешь
???
С какой
 
Назад
Сверху Снизу