I'm trying to create an AI that plays CS:GO.
But I could not move aim.
I tried pyautogui, win32api, pynput libraries, all of them worked on desktop or anywhere that have an cursor.
But in game there is no cursor and as I followed position of mouse is stay at middle ((1920/2, 1080/2), for me) when move mouse to turn it increases for a short time then backs to that position.
How can I move aim in CS:GO or GTAV or anygame by python. what is the difference between python code and real mouse?
I do not think this is because of anti-cheat because it did not worked on GTAV
I looked same topics but they did not solve my problem
Codes where similar for all libraries so the code that I used is this:
import pyautogui, sys
import _thread
import time
time.sleep(2)
def kaydir(miktarX, miktarY):
pyautogui.moveRel(miktarX, miktarY)
print('Press Ctrl-C to quit.')
try:
while True:
x, y = pyautogui.position()
positionStr = 'X: ' + str(x).rjust(4) + ' Y: ' + str(y).rjust(4)
print(positionStr, end='')
print('\b' * len(positionStr), end='', flush=True)
_thread.start_new_thread(kaydir, (1, 1))
time.sleep(0.08)
except KeyboardInterrupt:
print('\n')