def getFrame():
    hwnd = win32gui.FindWindow(None, r'Grand Theft Auto V')
    win32gui.SetForegroundWindow(hwnd)
    dimensions = win32gui.GetWindowRect(hwnd)
    pressKey(DIK_E)
    pressKey(DIK_PAGE_UP)
    sleep(1)
    image = ImageGrab.grab(dimensions)
    return image
def mainThread():
    global inputBet, inputColor
    print(
        "\n\n\nWelcome to the gta casino roulette autobet bot. Please put your game in Windowed mode"
    )
    inputBet = int(input("Enter base bet (ex. 1500): "))
    inputColor = input("Enter bet color (ex. red, black, green): ")
    print("\nPress 'END' to toggle the script ON/OFF \n\n\n")
    bet_color = inputColor
    small_bet = inputBet
    betting_target = inputBet
    finished_betting = False
    lastmoney = 0
    lastcolor = ""
    rounds_played = 0
    increased = False
    bet_list = [100, 500, 1000, 5000, 10000]
    while True:
        if startScript:
            frame = getFrame()
            time = get_time(frame)
            if time != 0:
                if finished_betting == False:
                    print("Current time: ", time)
                    current_money = get_current_Money(frame)
                    current_bet = get_current_Bet(frame)
                    currentColor = get_last_color(frame)
                    center_frame = [frame.size[0] / 2, frame.size[1] / 2]
                    if current_money < lastmoney and rounds_played != 0 and increased == False:
                        print("bet target increased")
                        betting_target *= 2
                        increased = True
                    elif current_money >= lastmoney:
                        betting_target = small_bet
                    if current_bet == betting_target:
                        rounds_played += 1
                        print("\n\n")
                        print("Rounds played: ", rounds_played)
                        print("Current color: ", currentColor)
                        print("Last color: ", lastcolor)
                        print("Current money: ", current_money)
                        print("Current bet: ", current_bet)
                        print("Current target: ", betting_target)
                        print("\n\n")
                        lastmoney = current_money
                        lastcolor = currentColor
                        finished_betting = True
                    else:
                        #increment bet
                        for i in range(5):
                            pressKey(DIK_ARROW_DOWN)
                            sleep(0.07)
                            releaseKey(DIK_ARROW_DOWN)
                        if bet_color == "red":
                            autoit.mouse_move(int(center_frame[0] - 90),
                                              int(center_frame[1] + 330))
                        elif bet_color == "black":
                            autoit.mouse_move(int(center_frame[0] + 90),
                                              int(center_frame[1] + 330))
                        elif bet_color == "green":
                            autoit.mouse_move(int(center_frame[0] - 550),
                                              int(center_frame[1]) - 75)
                        for k in reversed(bet_list):
                            temp = (betting_target - current_bet) - k
                            if temp >= 0:
                                for x in range(bet_list.index(k)):
                                    pressKey(DIK_ARROW_UP)
                                    sleep(0.09)
                                    releaseKey(DIK_ARROW_UP)
                                autoit.mouse_down("left")
                                sleep(0.15)
                                autoit.mouse_up("left")
                                break
            else:
                finished_betting = False
                increased = False
        else:
            releaseFrame()
Ejemplo n.º 3
0
def right():
    pressKey(D)
    releaseKey(A)
    releaseKey(D)
Ejemplo n.º 4
0
def left():
    pressKey(A)
    releaseKey(D)
    releaseKey(A)
Ejemplo n.º 5
0
def straight():
    pressKey(W)
    releaseKey(A)
    releaseKey(D)
Ejemplo n.º 6
0
    processed_img = cv2.Canny(processed_img, threshold1=200, threshold2=300)
    processed_img = cv2.GaussianBlur(processed_img, (5, 5), 0)
    ##    vertices = np.array([[10,500],[10,300],[300,200],[500,200],[800,300],[800,500]])
    vertices = np.array([[0, 500], [0, 200], [300, 130], [450, 130],
                         [800, 200], [800, 500]])
    processed_img = roi(processed_img, [vertices])
    lines = cv2.HoughLinesP(processed_img, 1, np.pi / 180, 180, np.array([]),
                            100, 5)
    ##    draw_lines(processed_img,lines)
    m, mm = draw_lanes(original_screen, lines)
    return processed_img, m, mm


last_time = time.time()
##time.sleep(3)
pressKey(W)
while (True):
    screen = np.array(ImageGrab.grab(bbox=(0, 40, 800, 640)))
    new_screen, m, mm = process_img(screen)
    print time.time() - last_time
    last_time = time.time()
    screen = cv2.cvtColor(screen, cv2.COLOR_BGR2RGB)
    ##    cv2.imshow('window', new_screen)
    cv2.imshow('lanes', screen)

    if m > 0 and mm > 0:
        right()
    elif m < 0 and mm < 0:
        left()
    else:
        straight()