-
Автор темы
- #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 * 0.75
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)
head_pos[1] -= 30
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 * 0.6
hp_bar_height = 8
hp_bar_x_left = head_pos[0] - hp_bar_width / 2
hp_bar_y_top = head_pos[1] + 12
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))
dark_green = imgui.get_color_u32_rgba(0, 0.5, 0, 1)
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, dark_green)
hp_text = f"{int(entity_hp)} HP"
text_color = imgui.get_color_u32_rgba(1, 1, 1, 1)
imgui.get_window_draw_list().add_text(hp_bar_x_left, hp_bar_y_top + 2, text_color, hp_text)
except:
return