diff --git a/GUIDE.md b/GUIDE.md index 43bbdf3..7f5efff 100644 --- a/GUIDE.md +++ b/GUIDE.md @@ -38,6 +38,11 @@ class Mycheat(Hack): 5. For more examples, see [the cheats already done](./cheats/) +6. If your cheat logic modifies the same memory of another cheat at the same + time, then add that cheat to the list of incompatibilities in [cheat](./cheat.py) + after the `Incompatible cheats` comment. Add only one entry for your cheat, + it will automatically propagate to the other ones + ## Extra infos - `self.pm` is used to read/write memory diff --git a/cheat.py b/cheat.py index 8108326..d866e54 100644 --- a/cheat.py +++ b/cheat.py @@ -23,3 +23,15 @@ class Cheat(*[child for child in Hack.__subclasses__()]): # type: ignore if not func.endswith("_unload") # Utils if not func.startswith("find_")] + + self.incompatible = dict.fromkeys(self.cheats_list, []) + + # Incompatible cheats + self.incompatible["aimbot"] = ["norecoil"] + + # Builds the implicit list + for cheat, incompatible_cheat_list in self.incompatible.items(): + for incompatible_cheat in incompatible_cheat_list: + if not cheat in self.incompatible[incompatible_cheat]: + self.incompatible[incompatible_cheat] = self.incompatible[incompatible_cheat] + [ + cheat] diff --git a/main.py b/main.py index 44b174e..1a15212 100644 --- a/main.py +++ b/main.py @@ -60,10 +60,13 @@ if __name__ == "__main__": c_id = [] print("Invalid ID.") - # Instanciate and run threads - for fn in [c.cheats_list[i] for i in c_id]: + # Instanciate and run threads, removing incompatibilites + running = [] + for fn in [c.cheats_list[i] for i in c_id + if any(map(lambda v: v in c.incompatible[fn], running))]: print(f"Running {fn}...") t = Thread(target=getattr(c, fn)) + running.append(fn) t.daemon = True t.start()