-
Автор темы
- #1
Python:
def esp(draw_list):
if esp_rendering == 0:
return
view_matrix = []
for i in range(16):
temp_mat_val = pm.read_float(client + dwViewMatrix + i * 4)
view_matrix.append(temp_mat_val)
local_player_pawn_addr = pm.read_longlong(client + dwLocalPlayerPawn)
try:
local_player_team = pm.read_int(local_player_pawn_addr + m_iTeamNum)
except:
return
center_x = WINDOW_WIDTH / 2
center_y = WINDOW_HEIGHT / 2
for i in range(64):
entity = pm.read_longlong(client + dwEntityList)
if not entity:
continue
list_entry = pm.read_longlong(entity + ((8 * (i & 0x7FFF) >> 9) + 16))
if not list_entry:
continue
entity_controller = pm.read_longlong(list_entry + (120) * (i & 0x1FF))
if not entity_controller:
continue
entity_controller_pawn = pm.read_longlong(entity_controller + m_hPlayerPawn)
if not entity_controller_pawn:
continue
list_entry = pm.read_longlong(entity + (0x8 * ((entity_controller_pawn & 0x7FFF) >> 9) + 16))
if not list_entry:
continue
entity_pawn_addr = pm.read_longlong(list_entry + (120) * (entity_controller_pawn & 0x1FF))
if not entity_pawn_addr or entity_pawn_addr == local_player_pawn_addr:
continue
entity_alive = pm.read_int(entity_pawn_addr + m_lifeState)
if entity_alive != 256:
continue
entity_team = pm.read_int(entity_pawn_addr + m_iTeamNum)
if entity_team == local_player_team and esp_mode == 0:
continue
color = imgui.get_color_u32_rgba(0, 1, 0, 1) if entity_team == local_player_team else imgui.get_color_u32_rgba(1, 0, 0, 1)
game_scene = pm.read_longlong(entity_pawn_addr + m_pGameSceneNode)
bone_matrix = pm.read_longlong(game_scene + m_modelState + 0x80)
try:
headX = pm.read_float(bone_matrix + 6 * 0x20)
headY = pm.read_float(bone_matrix + 6 * 0x20 + 0x4)
headZ = pm.read_float(bone_matrix + 6 * 0x20 + 0x8) + 8
head_pos = w2s(view_matrix, headX, headY, headZ, WINDOW_WIDTH, WINDOW_HEIGHT)
if line_rendering == 1:
legZ = pm.read_float(bone_matrix + 28 * 0x20 + 0x8)
leg_pos = w2s(view_matrix, headX, headY, legZ, WINDOW_WIDTH, WINDOW_HEIGHT)
bottom_left_x = head_pos[0] - (head_pos[0] - leg_pos[0]) // 2
bottom_y = leg_pos[1]
draw_list.add_line(bottom_left_x, bottom_y, center_x, center_y, color, 2.0)
legZ = pm.read_float(bone_matrix + 28 * 0x20 + 0x8)
leg_pos = w2s(view_matrix, headX, headY, legZ, WINDOW_WIDTH, WINDOW_HEIGHT)
deltaZ = abs(head_pos[1] - leg_pos[1])
leftX = head_pos[0] - deltaZ // 3
rightX = head_pos[0] + deltaZ // 3
draw_list.add_line(leftX, leg_pos[1], rightX, leg_pos[1], color, 2.0)
draw_list.add_line(leftX, leg_pos[1], leftX, head_pos[1], color, 2.0)
draw_list.add_line(rightX, leg_pos[1], rightX, head_pos[1], color, 2.0)
draw_list.add_line(leftX, head_pos[1], rightX, head_pos[1], color, 2.0)
if hp_bar_rendering == 1:
entity_hp = pm.read_int(entity_pawn_addr + m_iHealth)
max_hp = 100
hp_percentage = min(1.0, max(0.0, entity_hp / max_hp))
hp_bar_width = deltaZ // 2
hp_bar_height = 5
hp_bar_x_left = head_pos[0] - hp_bar_width / 2
hp_bar_y_top = head_pos[1] - deltaZ / 6
hp_bar_y_bottom = hp_bar_y_top - hp_bar_height
draw_list.add_rect_filled(hp_bar_x_left, hp_bar_y_bottom, hp_bar_x_left + hp_bar_width, hp_bar_y_top, imgui.get_color_u32_rgba(0, 0, 0, 0.7))
draw_list.add_rect_filled(hp_bar_x_left, hp_bar_y_bottom, hp_bar_x_left + (hp_bar_width * hp_percentage), hp_bar_y_top, imgui.get_color_u32_rgba(1, 0, 0, 1))
hp_text = f"{entity_hp}"
hp_text_size = 12
hp_text_color = imgui.get_color_u32_rgba(1, 1, 1, 1)
hp_text_x = hp_bar_x_left + (hp_bar_width - imgui.calc_text_size(hp_text)[0]) / 2
hp_text_y = hp_bar_y_bottom - hp_text_size - 2
draw_list.add_text(hp_text_x, hp_text_y, hp_text_color, hp_text)
if head_hitbox_rendering == 1:
head_hitbox_size = (rightX - leftX) / 5
head_hitbox_radius = head_hitbox_size * 2 ** 0.5 / 2
head_hitbox_x = leftX + 2.5 * head_hitbox_size
head_hitbox_y = head_pos[1] + deltaZ / 8
draw_list.add_circle_filled(head_hitbox_x, head_hitbox_y, head_hitbox_radius, imgui.get_color_u32_rgba(1, 0, 0, 1))
if skeleton_esp_rendering == 1:
BONE_CONNECTIONS = [
(0, 2),
(2, 4),
(4, 5),
(5, 6),
(4, 8),
(8, 9),
(9, 10),
(4, 13),
(13, 14),
(14, 15),
(0, 22),
(22, 23),
(23, 24),
(0, 25),
(25, 26),
(26, 27)
]
for bone_start, bone_end in BONE_CONNECTIONS:
start_pos = w2s(view_matrix, pm.read_float(bone_matrix + bone_start * 0x20), pm.read_float(bone_matrix + bone_start * 0x20 + 0x4), pm.read_float(bone_matrix + bone_start * 0x20 + 0x8), WINDOW_WIDTH, WINDOW_HEIGHT)
end_pos = w2s(view_matrix, pm.read_float(bone_matrix + bone_end * 0x20), pm.read_float(bone_matrix + bone_end * 0x20 + 0x4), pm.read_float(bone_matrix + bone_end * 0x20 + 0x8), WINDOW_WIDTH, WINDOW_HEIGHT)
if start_pos[0] != -999 and end_pos[0] != -999:
draw_list.add_line(start_pos[0], start_pos[1], end_pos[0], end_pos[1], color, 2.0)
if arrow_rendering == 1:
legZ = pm.read_float(bone_matrix + 28 * 0x20 + 0x8)
leg_pos = w2s(view_matrix, headX, headY, legZ, WINDOW_WIDTH, WINDOW_HEIGHT)
bottom_left_x = head_pos[0] - (head_pos[0] - leg_pos[0]) // 2
bottom_y = leg_pos[1]
line_dx = center_x - bottom_left_x
line_dy = center_y - bottom_y
length = math.sqrt(line_dx * line_dx + line_dy * line_dy)
if length > 0:
line_dx /= length
line_dy /= length
arrow_length = 20
arrow_width = 10
arrow_x = center_x
arrow_y = center_y
draw_list.add_line(arrow_x, arrow_y, arrow_x + arrow_length * line_dx, arrow_y + arrow_length * line_dy, color, 2.0)
draw_list.add_line(arrow_x + arrow_length * line_dx, arrow_y + arrow_length * line_dy, arrow_x + arrow_length * line_dx - arrow_width * line_dx * math.cos(math.pi / 6), arrow_y + arrow_length * line_dy - arrow_width * line_dy * math.sin(math.pi / 6), color, 2.0)
draw_list.add_line(arrow_x + arrow_length * line_dx, arrow_y + arrow_length * line_dy, arrow_x + arrow_length * line_dx - arrow_width * line_dx * math.cos(-math.pi / 6), arrow_y + arrow_length * line_dy - arrow_width * line_dy * math.sin(-math.pi / 6), color, 2.0)
except:
return