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

Вопрос Не ворк спектатор лист

  • Автор темы Автор темы c_nan0
  • Дата начала Дата начала
Начинающий
Начинающий
Статус
Оффлайн
Регистрация
2 Ноя 2024
Сообщения
108
Реакции
12
ну помогите

C++:
Expand Collapse Copy
void misc::RenderSpectatorList() {
    if (!vars::spectatorList || !entity::entity_system.local_player)
        return;

    entity::player_t local_player = entity::entity_system.get_local_player_pawn();
    if (!local_player.is_valid() || !local_player.is_alive())
        return;

    auto draw_list = ImGui::GetBackgroundDrawList();
    if (!draw_list) return;

    std::vector<std::string> spectator_names;
    std::vector<ImU32> spectator_colors;

    for (int i = 1; i < 64; ++i) {
        uintptr_t ctrl = entity::entity_system.get_entity_from_list(i);
        if (!ctrl) continue;

        entity::player_t player(0, ctrl);

        if (!player.is_valid())
            continue;

        uint32_t pawn_handle = memory::ReadUInt32(ctrl + cbaseplayercontroller::m_hpawn);
        if (!pawn_handle)
            continue;

        uintptr_t pawn = entity::entity_system.get_entity_from_list(pawn_handle & 0x7FFF);
        if (!pawn)
            continue;

        uintptr_t obs_services = memory::Read<uintptr_t>(pawn + c_baseplayerpawn::m_pobserverservices);
        if (!obs_services)
            continue;

        uint32_t obs_target_handle = memory::ReadUInt32(obs_services + cplayer_observerservices::m_hobservertarget);
        if (!obs_target_handle)
            continue;

        uintptr_t obs_target_pawn = entity::entity_system.get_entity_from_list(obs_target_handle & 0x7FFF);
        if (obs_target_pawn != entity::entity_system.local_player)
            continue;

        std::string name = player.get_name();
        if (name.empty())
            continue;

        spectator_names.push_back(name);

        int team = player.get_team();
        if (team == entity::entity_system.local_team) {
            spectator_colors.push_back(IM_COL32(50, 200, 50, 255));
        }
        else {
            spectator_colors.push_back(IM_COL32(255, 50, 50, 255));
        }
    }

    if (spectator_names.empty())
        return;

    vec2_t screen_size = utils::get_screen_size();
    float x_pos = screen_size.x - 200.0f;
    float y_pos = 50.0f;
    float line_height = 20.0f;

    for (size_t i = 0; i < spectator_names.size(); ++i) {
        std::string text = spectator_names[i];
        ImVec2 text_size = ImGui::CalcTextSize(text.c_str());
        ImVec2 text_pos = ImVec2(x_pos - text_size.x, y_pos + (i * line_height));

        draw_list->AddText(text_pos, spectator_colors[i], text.c_str());
    }
}
 
ну помогите

C++:
Expand Collapse Copy
void misc::RenderSpectatorList() {
    if (!vars::spectatorList || !entity::entity_system.local_player)
        return;

    entity::player_t local_player = entity::entity_system.get_local_player_pawn();
    if (!local_player.is_valid() || !local_player.is_alive())
        return;

    auto draw_list = ImGui::GetBackgroundDrawList();
    if (!draw_list) return;

    std::vector<std::string> spectator_names;
    std::vector<ImU32> spectator_colors;

    for (int i = 1; i < 64; ++i) {
        uintptr_t ctrl = entity::entity_system.get_entity_from_list(i);
        if (!ctrl) continue;

        entity::player_t player(0, ctrl);

        if (!player.is_valid())
            continue;

        uint32_t pawn_handle = memory::ReadUInt32(ctrl + cbaseplayercontroller::m_hpawn);
        if (!pawn_handle)
            continue;

        uintptr_t pawn = entity::entity_system.get_entity_from_list(pawn_handle & 0x7FFF);
        if (!pawn)
            continue;

        uintptr_t obs_services = memory::Read<uintptr_t>(pawn + c_baseplayerpawn::m_pobserverservices);
        if (!obs_services)
            continue;

        uint32_t obs_target_handle = memory::ReadUInt32(obs_services + cplayer_observerservices::m_hobservertarget);
        if (!obs_target_handle)
            continue;

        uintptr_t obs_target_pawn = entity::entity_system.get_entity_from_list(obs_target_handle & 0x7FFF);
        if (obs_target_pawn != entity::entity_system.local_player)
            continue;

        std::string name = player.get_name();
        if (name.empty())
            continue;

        spectator_names.push_back(name);

        int team = player.get_team();
        if (team == entity::entity_system.local_team) {
            spectator_colors.push_back(IM_COL32(50, 200, 50, 255));
        }
        else {
            spectator_colors.push_back(IM_COL32(255, 50, 50, 255));
        }
    }

    if (spectator_names.empty())
        return;

    vec2_t screen_size = utils::get_screen_size();
    float x_pos = screen_size.x - 200.0f;
    float y_pos = 50.0f;
    float line_height = 20.0f;

    for (size_t i = 0; i < spectator_names.size(); ++i) {
        std::string text = spectator_names[i];
        ImVec2 text_size = ImGui::CalcTextSize(text.c_str());
        ImVec2 text_pos = ImVec2(x_pos - text_size.x, y_pos + (i * line_height));

        draw_list->AddText(text_pos, spectator_colors[i], text.c_str());
    }
}
Ты сравниваешь указатели, а надо дескрипторы
 

Пожалуйста, зарегистрируйтесь или авторизуйтесь, чтобы увидеть содержимое.


C++:
Expand Collapse Copy
currentSpectators.clear();
if (cfg.specList) {
    uintptr_t localPawn = mem.Read<uintptr_t>(client + offsets::dwLocalPlayerPawn);
    uintptr_t localController = mem.Read<uintptr_t>(client + offsets::dwLocalPlayerController);
    uintptr_t entList = mem.Read<uintptr_t>(client + offsets::dwEntityList);

   
    uintptr_t myTargetPawn = localPawn;

    uintptr_t myObsServices = mem.Read<uintptr_t>(localPawn + offsets::m_pObserverServices);
    if (myObsServices) {
        uint32_t myTargetHandle = mem.Read<uint32_t>(myObsServices + offsets::m_hObserverTarget);
        if (myTargetHandle != 0xFFFFFFFF) {
            uintptr_t target = GetPawnFromHandle(mem, client, myTargetHandle);
            if (target != 0) {
                myTargetPawn = target;
            }
        }
    for (int i = 0; i < 64; i++) {
        
        uintptr_t listEntry = mem.Read<uintptr_t>(entList + (8 * (i & 0x7FFF) >> 9) + 16);
        if (!listEntry) continue;

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

        uint32_t pawnHandle = mem.Read<uint32_t>(controller + offsets::m_hPawn);
        uintptr_t pObsPawn = GetPawnFromHandle(mem, client, pawnHandle);
        if (!pObsPawn) continue;

        uintptr_t obsServices = mem.Read<uintptr_t>(pObsPawn + offsets::m_pObserverServices);
        if (!obsServices) continue;

        uint32_t targetHandle = mem.Read<uint32_t>(obsServices + offsets::m_hObserverTarget);
        if (targetHandle == 0xFFFFFFFF) continue;

        uintptr_t targetPawn = GetPawnFromHandle(mem, client, targetHandle);

        
        if (targetPawn == myTargetPawn && targetPawn != 0) {
            uintptr_t nPtr = mem.Read<uintptr_t>(controller + offsets::m_sSanitizedPlayerName);
            if (nPtr) {
                char name[128] = { 0 };
                ReadProcessMemory(mem.hProc, (LPCVOID)nPtr, name, 128, NULL);

                if (name[0] != '\0') {
                    currentSpectators.insert(name);
                }
            }
        }
    }
}
    }
 
Скрытое содержимое
C++:
Expand Collapse Copy
currentSpectators.clear();
if (cfg.specList) {
    uintptr_t localPawn = mem.Read<uintptr_t>(client + offsets::dwLocalPlayerPawn);
    uintptr_t localController = mem.Read<uintptr_t>(client + offsets::dwLocalPlayerController);
    uintptr_t entList = mem.Read<uintptr_t>(client + offsets::dwEntityList);

  
    uintptr_t myTargetPawn = localPawn;

    uintptr_t myObsServices = mem.Read<uintptr_t>(localPawn + offsets::m_pObserverServices);
    if (myObsServices) {
        uint32_t myTargetHandle = mem.Read<uint32_t>(myObsServices + offsets::m_hObserverTarget);
        if (myTargetHandle != 0xFFFFFFFF) {
            uintptr_t target = GetPawnFromHandle(mem, client, myTargetHandle);
            if (target != 0) {
                myTargetPawn = target;
            }
        }
    for (int i = 0; i < 64; i++) {
       
        uintptr_t listEntry = mem.Read<uintptr_t>(entList + (8 * (i & 0x7FFF) >> 9) + 16);
        if (!listEntry) continue;

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

        uint32_t pawnHandle = mem.Read<uint32_t>(controller + offsets::m_hPawn);
        uintptr_t pObsPawn = GetPawnFromHandle(mem, client, pawnHandle);
        if (!pObsPawn) continue;

        uintptr_t obsServices = mem.Read<uintptr_t>(pObsPawn + offsets::m_pObserverServices);
        if (!obsServices) continue;

        uint32_t targetHandle = mem.Read<uint32_t>(obsServices + offsets::m_hObserverTarget);
        if (targetHandle == 0xFFFFFFFF) continue;

        uintptr_t targetPawn = GetPawnFromHandle(mem, client, targetHandle);

       
        if (targetPawn == myTargetPawn && targetPawn != 0) {
            uintptr_t nPtr = mem.Read<uintptr_t>(controller + offsets::m_sSanitizedPlayerName);
            if (nPtr) {
                char name[128] = { 0 };
                ReadProcessMemory(mem.hProc, (LPCVOID)nPtr, name, 128, NULL);

                if (name[0] != '\0') {
                    currentSpectators.insert(name);
                }
            }
        }
    }
}
    }
 
Назад
Сверху Снизу