-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
130 lines (106 loc) · 3.79 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
import os
import math
import pygame
import win32api
import win32con
os.system('cls')
from memory import GetLocalPlayer, GetEntityList, GetName, GetPos, GetHealth, GetCam
def main():
pygame.init()
sc = pygame.display.set_mode((300, 300), pygame.RESIZABLE)
pygame.display.set_caption('External Radar Hack')
clock = pygame.time.Clock()
pygame.display.update()
font = pygame.font.SysFont('Arial', 12, False, False)
stop = False
while not win32api.GetAsyncKeyState(win32con.VK_PAUSE) and not stop:
for event in pygame.event.get():
if event.type == pygame.QUIT:
stop = True
sc.fill((20, 20, 20))
pygame.draw.line(
surface=sc,
color=(230, 230, 230),
start_pos=(
0,
sc.get_height() / 2
),
end_pos=(
sc.get_width(),
sc.get_height() / 2
)
)
pygame.draw.line(
surface=sc,
color=(230, 230, 230),
start_pos=(
sc.get_width() / 2,
sc.get_height()
),
end_pos=(
sc.get_width() / 2,
0
)
)
pygame.draw.circle(
surface=sc,
color=(20, 230, 20),
center=(
sc.get_width() / 2,
sc.get_height() / 2
),
radius=5
)
EntityListPointers = GetEntityList()
LocalPlayer = GetLocalPlayer()
local_x, _, local_z = GetPos(LocalPlayer)
local_yaw, local_pitch = GetCam(LocalPlayer)
local_yaw = (local_yaw - 360) * -1
for entity_ptr in EntityListPointers:
entity_x, _, entity_z = GetPos(entity_ptr)
x, z = entity_x - local_x, entity_z - local_z
angle_radians = math.atan2(z, x)
angle_degrees = math.degrees(angle_radians) * -1
angle_degrees -= 90
if angle_degrees < 0:
angle_degrees += 360
angle_degrees -= local_yaw
if angle_degrees < -180:
angle_degrees = angle_degrees % 180
distance = math.sqrt(x ** 2 + z ** 2) * 2.5
x_on_screen, y_on_screen = math.cos(math.radians(angle_degrees)), math.sin(math.radians(angle_degrees)) * -1
x_on_screen, y_on_screen = y_on_screen * distance, x_on_screen * distance
pygame.draw.circle(
surface=sc,
color=(230, 20, 20),
center=(
sc.get_width() / 2 + x_on_screen,
sc.get_height() / 2 - y_on_screen
),
radius=5
)
pygame.draw.aaline(
surface=sc,
color=(150, 150, 150),
start_pos=(
sc.get_width() / 2 + x_on_screen,
sc.get_height() / 2 - y_on_screen
),
end_pos=(
sc.get_width() / 2,
sc.get_height() / 2
)
)
text = font.render(f'{GetName(entity_ptr)}: {GetHealth(entity_ptr)}', True, (230, 230, 230))
sc.blit(
source=text,
dest=(
sc.get_width() / 2 + x_on_screen - text.get_width() / 2,
sc.get_height() / 2 - y_on_screen - text.get_height() - 5
)
)
pygame.display.update()
clock.tick(128)
pygame.quit()
if __name__ == '__main__':
main()