Если поставить меньше задержку то всё равно нагрузка не спадает. Как уменьшить нагрузку на процессор?
Код:
import os
import re
import keyboard
import pymem
from pymem import process
import time
import sys
from ui import Ui_Dialog
from offsets import *
from PySide import QtCore, QtGui
import threading
from threading import Thread
# create application
app = QtGui.QApplication(sys.argv)
# Create form and init UI
Dialog = QtGui.QDialog()
ui = Ui_Dialog()
ui.setupUi(Dialog)
Dialog.show()
# Hook Logic
_process = pymem.Pymem("csgo.exe")
_client = pymem.process.module_from_name(_process.process_handle, "client.dll").lpBaseOfDll
def start_bhop():
Thread(target=BHOP, daemon=True).start()
ui.pushButton.clicked.connect(start_bhop)
def BHOP():
while True:
try:
if keyboard.is_pressed("space"):
player = _process.read_int(_client + dwLocalPlayer)
jump = _client + dwForceJump
player_state = _process.read_int(player + m_fFlags)
if player_state == 257 or player_state == 263: # 257 - player on ground, 263 - crouch
_process.write_int(jump, 5)
time.sleep(0.1)
_process.write_int(jump, 4)
except pymem.exception.MemoryReadError:
pass
sys.exit(app.exec_())