-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocal.py
60 lines (43 loc) · 2.51 KB
/
local.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
from memory import *
from helper import *
import offsets, struct
class LocalPlayer():
def __init__(self, mem) -> None:
self.mem = mem
def local_player(self):
return self.mem.game_handle.read_uint(self.mem.client_dll + offsets.dwLocalPlayer)
def get_current_state(self):
return self.mem.game_handle.read_int(self.mem.client_dll + offsets.dwForceJump)
def get_flashbang_duration(self):
return self.mem.game_handle.read_float(self.local_player() + offsets.m_flFlashDuration)
def set_flashbang_duration(self, value):
self.mem.game_handle.write_float(self.local_player() + offsets.m_flFlashDuration, value)
def set_flashbang_alpha(self, value):
self.mem.game_handle.write_float(self.local_player() + offsets.m_flFlashMaxAlpha, value)
def get_crosshair_id(self):
return self.mem.game_handle.read_uint(self.local_player() + offsets.m_iCrosshairId)
def get_entity_by_crosshair(self):
return self.mem.game_handle.read_uint(self.mem.client_dll + offsets.dwEntityList + ((self.get_crosshair_id() - 1) * 0x10))
def get_team_by_crosshair(self, entity):
return self.mem.game_handle.read_int(entity + offsets.m_iTeamNum)
def get_health_by_crosshair(self, entity):
return self.mem.game_handle.read_int(entity + offsets.m_iHealth)
def force_jump(self, flag):
self.mem.game_handle.write_int(self.mem.client_dll + offsets.dwForceJump, flag)
def force_attack(self, flag):
self.mem.game_handle.write_uint(self.mem.client_dll + offsets.dwForceAttack, flag)
def force_attack2(self, flag):
self.mem.game_handle.write_uint(self.mem.client_dll + offsets.dwForceAttack2, flag)
def get_fov(self):
return self.mem.game_handle.read_int(self.local_player() + offsets.m_iDefaultFOV)
def set_fov(self, value):
self.mem.game_handle.write_int(self.local_player() + offsets.m_iDefaultFOV, value)
def aim_punch_angle(self):
x = self.mem.game_handle.read_float(self.local_player() + offsets.m_aimPunchAngle)
y = self.mem.game_handle.read_float(self.local_player() + offsets.m_aimPunchAngle + 0x4)
z = self.mem.game_handle.read_float(self.local_player() + offsets.m_aimPunchAngle + 0x8)
return Vector3(x, y, z)
def view_matrix(self):
view = self.mem.game_handle.read_bytes(self.mem.client_dll + offsets.dwViewMatrix, 64)
matrix = struct.unpack("16f", view)
return matrix