Загрузка данных


import pymem
import pymem.process
import pygame
import time
import math
import sys
import ctypes  # добавлено!

# === ВАШИ ОФФСЕТЫ ===
OFFSET_VIEW_MATRIX = 0x12EAF0      # Client + 0x12EAF0
OFFSET_ENTITY_LIST = 0x12043C8     # Engine + 0x12043C8
OFFSET_HEALTH = 0xF8
OFFSET_TEAM = 0xF0
OFFSET_ORIGIN = 0x130

ESP_ENABLED = True
BOX_SIZE = 20

def get_cs_window_size():
    """Автоматически получает размер окна CS 1.6"""
    hwnd = ctypes.windll.user32.FindWindowW(None, "Counter-Strike")
    if not hwnd:
        return 800, 600  # стандартное разрешение, если окно не найдено
    rect = ctypes.wintypes.RECT()
    ctypes.windll.user32.GetWindowRect(hwnd, ctypes.byref(rect))
    return rect.right - rect.left, rect.bottom - rect.top

def world_to_screen(x, y, z, view_matrix, sw, sh):
    w = view_matrix[12]*x + view_matrix[13]*y + view_matrix[14]*z + view_matrix[15]
    if w < 0.01:
        return None
    sx = view_matrix[0]*x + view_matrix[1]*y + view_matrix[2]*z + view_matrix[3]
    sy = view_matrix[4]*x + view_matrix[5]*y + view_matrix[6]*z + view_matrix[7]
    sx = (sw / 2) * (1 + sx / w)
    sy = (sh / 2) * (1 - sy / w)
    return (sx, sy)

def main():
    global ESP_ENABLED
    
    print("=== CS 1.6 ESP (pygame) ===")
    print("Rutube: https://rutube.ru/channel/43805541")
    print("Telegram: hackeriks")
    print()
    
    # Получаем размер окна CS 1.6
    SCREEN_W, SCREEN_H = get_cs_window_size()
    print(f"[+] Размер окна CS 1.6: {SCREEN_W}x{SCREEN_H}")
    
    # Инициализация pygame
    pygame.init()
    screen = pygame.display.set_mode((SCREEN_W, SCREEN_H), pygame.NOFRAME)
    pygame.display.set_caption("ESP")
    clock = pygame.time.Clock()
    
    # Делаем окно поверх всех окон
    hwnd = pygame.display.get_wm_info()["window"]
    ctypes.windll.user32.SetWindowPos(hwnd, -1, 0, 0, 0, 0, 0x0002 | 0x0001)
    ctypes.windll.user32.SetLayeredWindowAttributes(hwnd, 0, 0, 0x00000001)
    
    try:
        pm = pymem.Pymem("hl.exe")
        print("[+] hl.exe найден")
    except:
        print("[-] CS 1.6 не запущена")
        pygame.quit()
        return
    
    # Получаем базы модулей
    engine = pymem.process.module_from_name(pm.process_handle, "hw.dll")
    client = pymem.process.module_from_name(pm.process_handle, "client.dll")
    
    engine_base = engine.lpBaseOfDll
    client_base = client.lpBaseOfDll
    
    view_matrix_addr = client_base + OFFSET_VIEW_MATRIX
    entity_list_addr = engine_base + OFFSET_ENTITY_LIST
    
    print("[*] ESP активен. F1 - вкл/выкл, ESC - выход")
    
    running = True
    while running:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                running = False
            elif event.type == pygame.KEYDOWN:
                if event.key == pygame.K_ESCAPE:
                    running = False
                elif event.key == pygame.K_F1:
                    ESP_ENABLED = not ESP_ENABLED
                    print(f"ESP: {'ON' if ESP_ENABLED else 'OFF'}")
        
        if not ESP_ENABLED:
            pygame.display.flip()
            clock.tick(30)
            continue
        
        # Очищаем экран (делаем прозрачным)
        screen.fill((0, 0, 0))
        
        try:
            # Читаем матрицу вида
            view_matrix = [pm.read_float(view_matrix_addr + i*4) for i in range(16)]
            
            # Читаем EntityList
            entity_list = pm.read_int(entity_list_addr)
            if not entity_list:
                pygame.display.flip()
                clock.tick(30)
                continue
            
            # Перебираем игроков
            for i in range(1, 33):
                entity = pm.read_int(entity_list + i * 4)
                if not entity:
                    continue
                
                health = pm.read_int(entity + OFFSET_HEALTH)
                if health <= 0:
                    continue
                
                team = pm.read_int(entity + OFFSET_TEAM)
                x = pm.read_float(entity + OFFSET_ORIGIN)
                y = pm.read_float(entity + OFFSET_ORIGIN + 4)
                z = pm.read_float(entity + OFFSET_ORIGIN + 8)
                
                screen_pos = world_to_screen(x, y, z + 60, view_matrix, SCREEN_W, SCREEN_H)
                if screen_pos:
                    sx, sy = screen_pos
                    # Разный цвет для врагов и союзников (опционально)
                    color = (255, 0, 0) if team != 2 else (0, 0, 255)
                    pygame.draw.rect(screen, color, (sx - BOX_SIZE//2, sy - BOX_SIZE//2, BOX_SIZE, BOX_SIZE), 2)
                    
        except Exception as e:
            pass
        
        pygame.display.flip()
        clock.tick(60)
    
    pygame.quit()

if __name__ == "__main__":
    main()