From 6ccf2962cf88d6c0a650d201743bbc650a20857b Mon Sep 17 00:00:00 2001 From: Mylloon Date: Thu, 30 Mar 2023 14:33:14 +0200 Subject: [PATCH] use hack loop for all methods --- main.py | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/main.py b/main.py index 3da45d8..959b162 100644 --- a/main.py +++ b/main.py @@ -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