don't unload when nothing has been loaded

This commit is contained in:
Mylloon 2023-04-04 11:14:10 +02:00
parent 7d4fe15646
commit 56b1a5964b
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
4 changed files with 26 additions and 7 deletions

View file

@ -1,7 +1,7 @@
from struct import pack from struct import pack
from hack import Hack from hack import Hack
from utils import Color3i from utils import Color3i, errors_unload
class Chams(Hack): class Chams(Hack):
@ -83,10 +83,14 @@ class Chams(Hack):
# Aliases # Aliases
mem = self.pm mem = self.pm
offset = self.offsets offset = self.offsets
color = self.__default_color[0] try:
brightness = self.__default_color[1] color = self.__default_color[0] # type: ignore
client = self.__client brightness = self.__default_color[1] # type: ignore
engine = self.__engine client = self.__client
engine = self.__engine
except errors_unload():
# No modification has been done
return
# Loop all entities # Loop all entities
for i in range(1, 32): # 0 is world for i in range(1, 32): # 0 is world

View file

@ -1,6 +1,7 @@
from win32api import GetAsyncKeyState from win32api import GetAsyncKeyState
from hack import Hack from hack import Hack
from utils import errors_unload
class Fov(Hack): class Fov(Hack):
@ -55,7 +56,11 @@ class Fov(Hack):
# Aliases # Aliases
mem = self.pm mem = self.pm
offset = self.offsets offset = self.offsets
local_player = self.__local_player try:
local_player = self.__local_player
except errors_unload():
# No modification has been done
return
# Reset to default value if changed # Reset to default value if changed
if self.__fov not in [None, self.__default_fov]: if self.__fov not in [None, self.__default_fov]:

View file

@ -1,4 +1,5 @@
from hack import Hack, sleep from hack import Hack, sleep
from utils import errors_unload
class Noflash(Hack): class Noflash(Hack):
@ -34,7 +35,11 @@ class Noflash(Hack):
# Aliases # Aliases
mem = self.pm mem = self.pm
offset = self.offsets offset = self.offsets
local_player = self.__local_player try:
local_player = self.__local_player
except errors_unload():
# No modification has been done
return
# Reset to default value # Reset to default value
mem.write_float( mem.write_float(

View file

@ -151,3 +151,8 @@ class Color4f:
a = round(self.a, max_precision) a = round(self.a, max_precision)
return f"{self.__class__.__name__}({r}, {g}, {b}, {a})" return f"{self.__class__.__name__}({r}, {g}, {b}, {a})"
def errors_unload():
"""Return error who can occurs when unloading cheats"""
return (TypeError, AttributeError)