optimizations

This commit is contained in:
Mylloon 2023-03-31 00:58:44 +02:00
parent a26b625336
commit b5807f7ab3
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 22 additions and 9 deletions

View file

@ -76,6 +76,10 @@ class Cheat(Hack):
if mem.read_uint(entity + offset["m_iTeamNum"]) == local_team:
continue
# Ignore dormant
if mem.read_bool(entity + offset["m_bDormant"]):
continue
# Check if ennemy is alive
if not mem.read_uint(entity + offset["m_iHealth"]):
continue
@ -116,6 +120,10 @@ class Cheat(Hack):
if mem.read_uint(entity + offset["m_iTeamNum"]) == local_team:
continue
# Ignore dormant
if mem.read_bool(entity + offset["m_bDormant"]):
continue
# Check if ennemy is alive
if not mem.read_uint(entity + offset["m_iHealth"]):
continue
@ -201,8 +209,8 @@ class Cheat(Hack):
# Get local player
local_player = self.find_uint(client, offset["dwLocalPlayer"])
# Float size
float_offset = 4
# Get client state
client_state = mem.read_uint(engine + offset["dwClientState"])
# Control variable
self.nr__old_punch_x = 0.
@ -211,13 +219,12 @@ class Cheat(Hack):
def cheat():
# Check if player is shooting
if mem.read_int(local_player + offset["m_iShotsFired"]):
client_state = mem.read_uint(engine + offset["dwClientState"])
# Where player is looking
view_angles_x = mem.read_float(
client_state + offset["dwClientState_ViewAngles"])
view_angles_y = mem.read_float(
client_state + offset["dwClientState_ViewAngles"] + float_offset)
client_state + offset["dwClientState_ViewAngles"] + offset["float"])
# Server multiple punch by 2
server_mult = 2.
@ -226,7 +233,7 @@ class Cheat(Hack):
aim_punch_x = mem.read_float(
local_player + offset["m_aimPunchAngle"]) * server_mult
aim_punch_y = mem.read_float(
local_player + offset["m_aimPunchAngle"] + float_offset) * server_mult
local_player + offset["m_aimPunchAngle"] + offset["float"]) * server_mult
# New angles
new_angle_x = view_angles_x + self.nr__old_punch_x - aim_punch_x
@ -248,7 +255,7 @@ class Cheat(Hack):
mem.write_float(
client_state + offset["dwClientState_ViewAngles"], new_angle_x)
mem.write_float(
client_state + offset["dwClientState_ViewAngles"] + float_offset, new_angle_y)
client_state + offset["dwClientState_ViewAngles"] + offset["float"], new_angle_y)
self.nr__old_punch_x = aim_punch_x
self.nr__old_punch_y = aim_punch_y
@ -274,7 +281,6 @@ class Cheat(Hack):
# Get module addresses
client = self.find_module("client")
engine = self.find_module("engine")
# Get local player
local_player = self.find_uint(client, offset["dwLocalPlayer"])
@ -296,6 +302,10 @@ class Cheat(Hack):
if mem.read_uint(entity + offset["m_iTeamNum"]) == local_team:
continue
# Ignore dormant
if mem.read_bool(entity + offset["m_bDormant"]):
continue
# Check if ennemy is alive
if not mem.read_uint(entity + offset["m_iHealth"]):
continue
@ -311,7 +321,9 @@ class Cheat(Hack):
entity + offset["m_clrRender"] + offset["render_G"], 255)
# mem.write_uint(
# entity + offset["m_clrRender"] + offset["render_B"], 0)
sleep(10)
# Once this is set, no need to recycle again
sleep(100)
self.hack_loop(cheat)

View file

@ -33,7 +33,8 @@ class Hack():
"GOM_visible": 0x28,
"render_R": 0x0,
"render_G": 0x1,
"render_B": 0x2
"render_B": 0x2,
"float": 0x4,
}
def _find_process(self, verbose: bool = False) -> Pymem: