use hack loop for all methods

This commit is contained in:
Mylloon 2023-03-30 14:33:14 +02:00
parent 1d775c971c
commit 6ccf2962cf
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

31
main.py
View file

@ -67,6 +67,15 @@ class Hack():
return local_element
def hack_loop(self, method):
"""Run the hack loop"""
while True:
# Reduce CPU usage
sleep(self.wait_time)
# Cheat
method()
class Cheat(Hack):
def __init__(self) -> None:
@ -77,6 +86,8 @@ class Cheat(Hack):
if callable(getattr(self, func))
# User defined
if not func.startswith("_")
# Hack loop
if not func == "hack_loop"
# Utils
if not func.startswith("find_")]
@ -91,18 +102,14 @@ class Cheat(Hack):
# Get player
local_player = self.find_uint(client, offset["dwLocalPlayer"])
# Hack loop
while True:
# Reduce CPU usage
sleep(self.wait_time)
def cheat():
# Pressing space bar
if not GetAsyncKeyState(ord(" ")):
continue
return
# Check if player is alive
if not mem.read_uint(local_player + offset["m_iHealth"]):
continue
return
# Check if player on ground
if mem.read_uint(local_player + offset["m_fFlags"]) & (1 << 0):
@ -110,6 +117,8 @@ class Cheat(Hack):
sleep(0.01)
mem.write_uint(client + offset["dwForceJump"], 4)
self.hack_loop(cheat)
def radar_hack(self) -> None:
# Aliases
mem = self.pm
@ -124,11 +133,7 @@ class Cheat(Hack):
# Get local team
local_team = self.find_uint(local_player, offset["m_iTeamNum"])
# Hack loop
while True:
# Reduce CPU usage
sleep(self.wait_time)
def cheat():
# Show ennemies
for i in range(1, 64): # 0 is world
entity = mem.read_uint(
@ -147,6 +152,8 @@ class Cheat(Hack):
mem.write_bool(entity + offset["m_bSpotted"], True)
self.hack_loop(cheat)
if __name__ == "__main__":
# Cheat