add unload infos

This commit is contained in:
Mylloon 2023-04-05 13:07:39 +02:00
parent 4898de1c2b
commit 3f11ccb9fa
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -6,26 +6,38 @@
```python ```python
from hack import Hack from hack import Hack
class Yourcheat(Hack): class Mycheat(Hack):
def __init__(self, **kwargs) -> None: def __init__(self, **kwargs) -> None:
super().__init__(**kwargs) super().__init__(**kwargs)
# Here you can initialize global variables for your cheat
``` ```
3. Add the method who will contains the cheat logic, note that: 3. Add the method who will contains the cheat logic, note that:
- Your method must contains a sub-method and must be added to - Your method must contains a sub-method and must be added to
the `hackloop` at the end of the method (see example below). the `hackloop` at the end of the method (see example below)
```python ```python
def mycheat(self) -> None: def mycheat(self) -> None:
# Cheat initialization, will run only one time # Cheat initialization, will only run once
def cheat(): def cheat():
# Your cheat logic, will be looped # Your cheat logic, will be looped
# Setup the loop # Setting up the loop
self.hack_loop(cheat) self.hack_loop(cheat)
``` ```
4. If you need to unload something before closing the app (e.g. restore the
initial state of something), you can add a second method called
`MYCHEAT_unload` with `MYCHEAT` the same name as the previous method
```python
def mycheat_unload(self) -> None:
# Called when the app is closed
```
5. For more examples, see [the cheats already done](./cheats/)
## Extra infos ## Extra infos
- `self.pm` is used to read/write memory - `self.pm` is used to read/write memory