optimizations
This commit is contained in:
parent
a26b625336
commit
b5807f7ab3
2 changed files with 22 additions and 9 deletions
28
cheat.py
28
cheat.py
|
@ -76,6 +76,10 @@ class Cheat(Hack):
|
||||||
if mem.read_uint(entity + offset["m_iTeamNum"]) == local_team:
|
if mem.read_uint(entity + offset["m_iTeamNum"]) == local_team:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
# Ignore dormant
|
||||||
|
if mem.read_bool(entity + offset["m_bDormant"]):
|
||||||
|
continue
|
||||||
|
|
||||||
# Check if ennemy is alive
|
# Check if ennemy is alive
|
||||||
if not mem.read_uint(entity + offset["m_iHealth"]):
|
if not mem.read_uint(entity + offset["m_iHealth"]):
|
||||||
continue
|
continue
|
||||||
|
@ -116,6 +120,10 @@ class Cheat(Hack):
|
||||||
if mem.read_uint(entity + offset["m_iTeamNum"]) == local_team:
|
if mem.read_uint(entity + offset["m_iTeamNum"]) == local_team:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
# Ignore dormant
|
||||||
|
if mem.read_bool(entity + offset["m_bDormant"]):
|
||||||
|
continue
|
||||||
|
|
||||||
# Check if ennemy is alive
|
# Check if ennemy is alive
|
||||||
if not mem.read_uint(entity + offset["m_iHealth"]):
|
if not mem.read_uint(entity + offset["m_iHealth"]):
|
||||||
continue
|
continue
|
||||||
|
@ -201,8 +209,8 @@ class Cheat(Hack):
|
||||||
# Get local player
|
# Get local player
|
||||||
local_player = self.find_uint(client, offset["dwLocalPlayer"])
|
local_player = self.find_uint(client, offset["dwLocalPlayer"])
|
||||||
|
|
||||||
# Float size
|
# Get client state
|
||||||
float_offset = 4
|
client_state = mem.read_uint(engine + offset["dwClientState"])
|
||||||
|
|
||||||
# Control variable
|
# Control variable
|
||||||
self.nr__old_punch_x = 0.
|
self.nr__old_punch_x = 0.
|
||||||
|
@ -211,13 +219,12 @@ class Cheat(Hack):
|
||||||
def cheat():
|
def cheat():
|
||||||
# Check if player is shooting
|
# Check if player is shooting
|
||||||
if mem.read_int(local_player + offset["m_iShotsFired"]):
|
if mem.read_int(local_player + offset["m_iShotsFired"]):
|
||||||
client_state = mem.read_uint(engine + offset["dwClientState"])
|
|
||||||
|
|
||||||
# Where player is looking
|
# Where player is looking
|
||||||
view_angles_x = mem.read_float(
|
view_angles_x = mem.read_float(
|
||||||
client_state + offset["dwClientState_ViewAngles"])
|
client_state + offset["dwClientState_ViewAngles"])
|
||||||
view_angles_y = mem.read_float(
|
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 multiple punch by 2
|
||||||
server_mult = 2.
|
server_mult = 2.
|
||||||
|
@ -226,7 +233,7 @@ class Cheat(Hack):
|
||||||
aim_punch_x = mem.read_float(
|
aim_punch_x = mem.read_float(
|
||||||
local_player + offset["m_aimPunchAngle"]) * server_mult
|
local_player + offset["m_aimPunchAngle"]) * server_mult
|
||||||
aim_punch_y = mem.read_float(
|
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 angles
|
||||||
new_angle_x = view_angles_x + self.nr__old_punch_x - aim_punch_x
|
new_angle_x = view_angles_x + self.nr__old_punch_x - aim_punch_x
|
||||||
|
@ -248,7 +255,7 @@ class Cheat(Hack):
|
||||||
mem.write_float(
|
mem.write_float(
|
||||||
client_state + offset["dwClientState_ViewAngles"], new_angle_x)
|
client_state + offset["dwClientState_ViewAngles"], new_angle_x)
|
||||||
mem.write_float(
|
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_x = aim_punch_x
|
||||||
self.nr__old_punch_y = aim_punch_y
|
self.nr__old_punch_y = aim_punch_y
|
||||||
|
@ -274,7 +281,6 @@ class Cheat(Hack):
|
||||||
|
|
||||||
# Get module addresses
|
# Get module addresses
|
||||||
client = self.find_module("client")
|
client = self.find_module("client")
|
||||||
engine = self.find_module("engine")
|
|
||||||
|
|
||||||
# Get local player
|
# Get local player
|
||||||
local_player = self.find_uint(client, offset["dwLocalPlayer"])
|
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:
|
if mem.read_uint(entity + offset["m_iTeamNum"]) == local_team:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
# Ignore dormant
|
||||||
|
if mem.read_bool(entity + offset["m_bDormant"]):
|
||||||
|
continue
|
||||||
|
|
||||||
# Check if ennemy is alive
|
# Check if ennemy is alive
|
||||||
if not mem.read_uint(entity + offset["m_iHealth"]):
|
if not mem.read_uint(entity + offset["m_iHealth"]):
|
||||||
continue
|
continue
|
||||||
|
@ -311,7 +321,9 @@ class Cheat(Hack):
|
||||||
entity + offset["m_clrRender"] + offset["render_G"], 255)
|
entity + offset["m_clrRender"] + offset["render_G"], 255)
|
||||||
# mem.write_uint(
|
# mem.write_uint(
|
||||||
# entity + offset["m_clrRender"] + offset["render_B"], 0)
|
# 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)
|
self.hack_loop(cheat)
|
||||||
|
|
||||||
|
|
3
hack.py
3
hack.py
|
@ -33,7 +33,8 @@ class Hack():
|
||||||
"GOM_visible": 0x28,
|
"GOM_visible": 0x28,
|
||||||
"render_R": 0x0,
|
"render_R": 0x0,
|
||||||
"render_G": 0x1,
|
"render_G": 0x1,
|
||||||
"render_B": 0x2
|
"render_B": 0x2,
|
||||||
|
"float": 0x4,
|
||||||
}
|
}
|
||||||
|
|
||||||
def _find_process(self, verbose: bool = False) -> Pymem:
|
def _find_process(self, verbose: bool = False) -> Pymem:
|
||||||
|
|
Reference in a new issue