Created
November 1, 2023 11:31
-
-
Save maduck/f298b92657fad023ac6ec02dae934ced to your computer and use it in GitHub Desktop.
GTA Online single session enabler for Windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import psutil | |
from pywinauto import Application | |
class GTAProcess: | |
PROCESS_NAME: str = 'GTA5.exe' | |
def __init__(self): | |
self.process = self.get_process() | |
def get_process(self) -> psutil.Process: | |
for process in psutil.process_iter(): | |
if process.name() == self.PROCESS_NAME: | |
return process | |
def freeze_process(self, seconds: int = 10) -> None: | |
print(f'Freezing for {seconds} seconds...') | |
with self.process.oneshot(): | |
self.process.suspend() | |
for countdown in range(seconds, 0, -1): | |
time.sleep(1) | |
print(f'\r{countdown}', end='', flush=True) | |
self.process.resume() | |
print('\rDone.') | |
def switch_to_window(self) -> None: | |
app = Application().connect(process=self.process.pid) | |
app.top_window().set_focus() | |
def alone_multiplayer(self) -> None: | |
self.freeze_process() | |
self.switch_to_window() | |
gta = GTAProcess() | |
gta.alone_multiplayer() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
psutil~=5.9 | |
pywinauto~=0.6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment