don't unload when nothing has been loaded
This commit is contained in:
parent
7d4fe15646
commit
56b1a5964b
4 changed files with 26 additions and 7 deletions
|
@ -1,7 +1,7 @@
|
|||
from struct import pack
|
||||
|
||||
from hack import Hack
|
||||
from utils import Color3i
|
||||
from utils import Color3i, errors_unload
|
||||
|
||||
|
||||
class Chams(Hack):
|
||||
|
@ -83,10 +83,14 @@ class Chams(Hack):
|
|||
# Aliases
|
||||
mem = self.pm
|
||||
offset = self.offsets
|
||||
color = self.__default_color[0]
|
||||
brightness = self.__default_color[1]
|
||||
client = self.__client
|
||||
engine = self.__engine
|
||||
try:
|
||||
color = self.__default_color[0] # type: ignore
|
||||
brightness = self.__default_color[1] # type: ignore
|
||||
client = self.__client
|
||||
engine = self.__engine
|
||||
except errors_unload():
|
||||
# No modification has been done
|
||||
return
|
||||
|
||||
# Loop all entities
|
||||
for i in range(1, 32): # 0 is world
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from win32api import GetAsyncKeyState
|
||||
|
||||
from hack import Hack
|
||||
from utils import errors_unload
|
||||
|
||||
|
||||
class Fov(Hack):
|
||||
|
@ -55,7 +56,11 @@ class Fov(Hack):
|
|||
# Aliases
|
||||
mem = self.pm
|
||||
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
|
||||
if self.__fov not in [None, self.__default_fov]:
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from hack import Hack, sleep
|
||||
from utils import errors_unload
|
||||
|
||||
|
||||
class Noflash(Hack):
|
||||
|
@ -34,7 +35,11 @@ class Noflash(Hack):
|
|||
# Aliases
|
||||
mem = self.pm
|
||||
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
|
||||
mem.write_float(
|
||||
|
|
5
utils.py
5
utils.py
|
@ -151,3 +151,8 @@ class Color4f:
|
|||
a = round(self.a, max_precision)
|
||||
|
||||
return f"{self.__class__.__name__}({r}, {g}, {b}, {a})"
|
||||
|
||||
|
||||
def errors_unload():
|
||||
"""Return error who can occurs when unloading cheats"""
|
||||
return (TypeError, AttributeError)
|
||||
|
|
Reference in a new issue