diff --git a/main.py b/main.py index 58dbc80..e5f8ae6 100644 --- a/main.py +++ b/main.py @@ -55,10 +55,11 @@ class Hack(): raise MemoryError def find_int(self, base, offset: int) -> int: - """Find integer in memory""" + """Find integer in memory for sure""" local_element = None while not local_element: local_element = self.pm.read_uint(base + offset) + sleep(self.timeout) return local_element @@ -97,7 +98,7 @@ class Cheat(Hack): continue # Check if player is alive - if not mem.read_int(local_player + offset["m_iHealth"]): + if not mem.read_uint(local_player + offset["m_iHealth"]): continue # Check if player on ground @@ -115,42 +116,33 @@ class Cheat(Hack): client = self.find_module("client") # Get local player - print("Looking for player...") local_player = self.find_int(client, offset["dwLocalPlayer"]) # Get local team - print("Looking for team...") local_team = self.find_int(local_player, offset["m_iTeamNum"]) - print("Looking for entities...") - # idx 0 == world - ennemies = [] - for i in range(1, 64): - entity = self.find_int( - client, offset["dwEntityList"] + i * 0x10) - - # Ignore allies - print("Check entity team...", end=" ") - if self.find_int(entity, offset["m_iTeamNum"] == local_team): - print("ally found...") - continue - - print("ennemy found...") - ennemies.append(entity) - # Hack loop - print("Running...") while True: # Reduce CPU usage sleep(self.wait_time) # Show ennemies - for ennemy in ennemies: - # Check if ennemy is alive - if not self.find_int(ennemy, offset["m_iHealth"]): + for i in range(1, 64): # 0 is world + entity = mem.read_uint( + client + offset["dwEntityList"] + i * 0x10) + + if not entity: continue - mem.write_bool(ennemy + offset["m_bSpotted"], True) + # Ignore allies + if mem.read_uint(entity + offset["m_iTeamNum"]) == local_team: + continue + + # Check if ennemy is alive + if not mem.read_uint(entity + offset["m_iHealth"]): + continue + + mem.write_bool(entity + offset["m_bSpotted"], True) if __name__ == "__main__":