mirror of
https://github.com/RootKit-Org/AI-Aimbot.git
synced 2025-06-21 02:41:01 +08:00
added more exception handling (#47)
This commit is contained in:
parent
132f3dfa23
commit
8e5cfaba04
16
main.py
16
main.py
@ -52,7 +52,12 @@ def main():
|
|||||||
exit()
|
exit()
|
||||||
|
|
||||||
# Select that Window
|
# Select that Window
|
||||||
|
try:
|
||||||
videoGameWindow.activate()
|
videoGameWindow.activate()
|
||||||
|
except Exception as e:
|
||||||
|
print("Failed to activate game window: {}".format(str(e)))
|
||||||
|
print("Read the relevant restrictions here: https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setforegroundwindow")
|
||||||
|
return
|
||||||
|
|
||||||
# Setting up the screen shots
|
# Setting up the screen shots
|
||||||
sctArea = {"mon": 1, "top": videoGameWindow.top + (videoGameWindow.height - screenShotHeight) // 2,
|
sctArea = {"mon": 1, "top": videoGameWindow.top + (videoGameWindow.height - screenShotHeight) // 2,
|
||||||
@ -73,6 +78,12 @@ def main():
|
|||||||
region = (left, top, right, bottom)
|
region = (left, top, right, bottom)
|
||||||
|
|
||||||
camera = dxcam.create(region=region)
|
camera = dxcam.create(region=region)
|
||||||
|
if camera is None:
|
||||||
|
print("""DXCamera failed to initialize. Some common causes are:
|
||||||
|
1. You are on a laptop with both an integrated GPU and discrete GPU. Go into Windows Graphic Settings, select python.exe and set it to Power Saving Mode.
|
||||||
|
If that doesn't work, then read this: https://github.com/SerpentAI/D3DShot/wiki/Installation-Note:-Laptops
|
||||||
|
2. The game is an exclusive full screen game. Set it to windowed mode.""")
|
||||||
|
return
|
||||||
camera.start(target_fps=120, video_mode=True)
|
camera.start(target_fps=120, video_mode=True)
|
||||||
|
|
||||||
# Calculating the center Autoaim box
|
# Calculating the center Autoaim box
|
||||||
@ -208,4 +219,9 @@ def main():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
try:
|
||||||
main()
|
main()
|
||||||
|
except Exception as e:
|
||||||
|
print("Please read the below message and think about how it could be solved before posting it on discord.")
|
||||||
|
print(str(e))
|
||||||
|
print("Please read the above message and think about how it could be solved before posting it on discord.")
|
||||||
|
@ -53,7 +53,12 @@ def main():
|
|||||||
exit()
|
exit()
|
||||||
|
|
||||||
# Select that Window
|
# Select that Window
|
||||||
|
try:
|
||||||
videoGameWindow.activate()
|
videoGameWindow.activate()
|
||||||
|
except Exception as e:
|
||||||
|
print("Failed to activate game window: {}".format(str(e)))
|
||||||
|
print("Read the relevant restrictions here: https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setforegroundwindow")
|
||||||
|
return
|
||||||
|
|
||||||
# Setting up the screen shots
|
# Setting up the screen shots
|
||||||
sctArea = {"mon": 1, "top": videoGameWindow.top + (videoGameWindow.height - screenShotHeight) // 2,
|
sctArea = {"mon": 1, "top": videoGameWindow.top + (videoGameWindow.height - screenShotHeight) // 2,
|
||||||
@ -71,6 +76,12 @@ def main():
|
|||||||
region = (left, top, right, bottom)
|
region = (left, top, right, bottom)
|
||||||
|
|
||||||
camera = dxcam.create(device_idx=0, region=region, max_buffer_len=5120)
|
camera = dxcam.create(device_idx=0, region=region, max_buffer_len=5120)
|
||||||
|
if camera is None:
|
||||||
|
print("""DXCamera failed to initialize. Some common causes are:
|
||||||
|
1. You are on a laptop with both an integrated GPU and discrete GPU. Go into Windows Graphic Settings, select python.exe and set it to Power Saving Mode.
|
||||||
|
If that doesn't work, then read this: https://github.com/SerpentAI/D3DShot/wiki/Installation-Note:-Laptops
|
||||||
|
2. The game is an exclusive full screen game. Set it to windowed mode.""")
|
||||||
|
return
|
||||||
camera.start(target_fps=160, video_mode=True)
|
camera.start(target_fps=160, video_mode=True)
|
||||||
|
|
||||||
print(dxcam.device_info())
|
print(dxcam.device_info())
|
||||||
@ -195,4 +206,9 @@ def main():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
try:
|
||||||
main()
|
main()
|
||||||
|
except Exception as e:
|
||||||
|
print("Please read the below message and think about how it could be solved before posting it on discord.")
|
||||||
|
print(str(e))
|
||||||
|
print("Please read the above message and think about how it could be solved before posting it on discord.")
|
@ -54,7 +54,12 @@ def main():
|
|||||||
exit()
|
exit()
|
||||||
|
|
||||||
# Select that Window
|
# Select that Window
|
||||||
|
try:
|
||||||
videoGameWindow.activate()
|
videoGameWindow.activate()
|
||||||
|
except Exception as e:
|
||||||
|
print("Failed to activate game window: {}".format(str(e)))
|
||||||
|
print("Read the relevant restrictions here: https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setforegroundwindow")
|
||||||
|
return
|
||||||
|
|
||||||
# Setting up the screen shots
|
# Setting up the screen shots
|
||||||
sctArea = {"mon": 1, "top": videoGameWindow.top + (videoGameWindow.height - screenShotHeight) // 2,
|
sctArea = {"mon": 1, "top": videoGameWindow.top + (videoGameWindow.height - screenShotHeight) // 2,
|
||||||
@ -72,6 +77,12 @@ def main():
|
|||||||
region = (left, top, right, bottom)
|
region = (left, top, right, bottom)
|
||||||
|
|
||||||
camera = dxcam.create(device_idx=0, region=region, max_buffer_len=5120)
|
camera = dxcam.create(device_idx=0, region=region, max_buffer_len=5120)
|
||||||
|
if camera is None:
|
||||||
|
print("""DXCamera failed to initialize. Some common causes are:
|
||||||
|
1. You are on a laptop with both an integrated GPU and discrete GPU. Go into Windows Graphic Settings, select python.exe and set it to Power Saving Mode.
|
||||||
|
If that doesn't work, then read this: https://github.com/SerpentAI/D3DShot/wiki/Installation-Note:-Laptops
|
||||||
|
2. The game is an exclusive full screen game. Set it to windowed mode.""")
|
||||||
|
return
|
||||||
camera.start(target_fps=160, video_mode=True)
|
camera.start(target_fps=160, video_mode=True)
|
||||||
|
|
||||||
# Calculating the center Autoaim box
|
# Calculating the center Autoaim box
|
||||||
@ -193,4 +204,9 @@ def main():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
try:
|
||||||
main()
|
main()
|
||||||
|
except Exception as e:
|
||||||
|
print("Please read the below message and think about how it could be solved before posting it on discord.")
|
||||||
|
print(str(e))
|
||||||
|
print("Please read the above message and think about how it could be solved before posting it on discord.")
|
@ -54,7 +54,12 @@ def main():
|
|||||||
exit()
|
exit()
|
||||||
|
|
||||||
# Select that Window
|
# Select that Window
|
||||||
|
try:
|
||||||
videoGameWindow.activate()
|
videoGameWindow.activate()
|
||||||
|
except Exception as e:
|
||||||
|
print("Failed to activate game window: {}".format(str(e)))
|
||||||
|
print("Read the relevant restrictions here: https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setforegroundwindow")
|
||||||
|
return
|
||||||
|
|
||||||
# Setting up the screen shots
|
# Setting up the screen shots
|
||||||
sctArea = {"mon": 1, "top": videoGameWindow.top + (videoGameWindow.height - screenShotHeight) // 2,
|
sctArea = {"mon": 1, "top": videoGameWindow.top + (videoGameWindow.height - screenShotHeight) // 2,
|
||||||
@ -72,6 +77,12 @@ def main():
|
|||||||
region = (left, top, right, bottom)
|
region = (left, top, right, bottom)
|
||||||
|
|
||||||
camera = dxcam.create(region=region)
|
camera = dxcam.create(region=region)
|
||||||
|
if camera is None:
|
||||||
|
print("""DXCamera failed to initialize. Some common causes are:
|
||||||
|
1. You are on a laptop with both an integrated GPU and discrete GPU. Go into Windows Graphic Settings, select python.exe and set it to Power Saving Mode.
|
||||||
|
If that doesn't work, then read this: https://github.com/SerpentAI/D3DShot/wiki/Installation-Note:-Laptops
|
||||||
|
2. The game is an exclusive full screen game. Set it to windowed mode.""")
|
||||||
|
return
|
||||||
camera.start(target_fps=160, video_mode=True)
|
camera.start(target_fps=160, video_mode=True)
|
||||||
|
|
||||||
# Calculating the center Autoaim box
|
# Calculating the center Autoaim box
|
||||||
@ -201,4 +212,9 @@ def main():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
try:
|
||||||
main()
|
main()
|
||||||
|
except Exception as e:
|
||||||
|
print("Please read the below message and think about how it could be solved before posting it on discord.")
|
||||||
|
print(str(e))
|
||||||
|
print("Please read the above message and think about how it could be solved before posting it on discord.")
|
@ -52,7 +52,12 @@ def main():
|
|||||||
exit()
|
exit()
|
||||||
|
|
||||||
# Select that Window
|
# Select that Window
|
||||||
|
try:
|
||||||
videoGameWindow.activate()
|
videoGameWindow.activate()
|
||||||
|
except Exception as e:
|
||||||
|
print("Failed to activate game window: {}".format(str(e)))
|
||||||
|
print("Read the relevant restrictions here: https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setforegroundwindow")
|
||||||
|
return
|
||||||
|
|
||||||
# Setting up the screen shots
|
# Setting up the screen shots
|
||||||
sctArea = {"mon": 1, "top": videoGameWindow.top + (videoGameWindow.height - screenShotHeight) // 2,
|
sctArea = {"mon": 1, "top": videoGameWindow.top + (videoGameWindow.height - screenShotHeight) // 2,
|
||||||
@ -70,6 +75,12 @@ def main():
|
|||||||
region = (left, top, right, bottom)
|
region = (left, top, right, bottom)
|
||||||
|
|
||||||
camera = dxcam.create(region=region)
|
camera = dxcam.create(region=region)
|
||||||
|
if camera is None:
|
||||||
|
print("""DXCamera failed to initialize. Some common causes are:
|
||||||
|
1. You are on a laptop with both an integrated GPU and discrete GPU. Go into Windows Graphic Settings, select python.exe and set it to Power Saving Mode.
|
||||||
|
If that doesn't work, then read this: https://github.com/SerpentAI/D3DShot/wiki/Installation-Note:-Laptops
|
||||||
|
2. The game is an exclusive full screen game. Set it to windowed mode.""")
|
||||||
|
return
|
||||||
camera.start(target_fps=120, video_mode=True)
|
camera.start(target_fps=120, video_mode=True)
|
||||||
|
|
||||||
# Calculating the center Autoaim box
|
# Calculating the center Autoaim box
|
||||||
@ -202,4 +213,9 @@ def main():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
try:
|
||||||
main()
|
main()
|
||||||
|
except Exception as e:
|
||||||
|
print("Please read the below message and think about how it could be solved before posting it on discord.")
|
||||||
|
print(str(e))
|
||||||
|
print("Please read the above message and think about how it could be solved before posting it on discord.")
|
Loading…
x
Reference in New Issue
Block a user