Results 1 to 2 of 2
  1. #1
    selex280811's Avatar
    Join Date
    Feb 2013
    Gender
    male
    Location
    Behind you :D
    Posts
    467
    Reputation
    10
    Thanks
    117
    My Mood
    Cool

    Mouse Input Not Working :(

    Hello so im totally new to C++ but i have already coded in C# for a long time so im not totally new to coding

    So i wanted to make a trigger bot for Paladins as i tried the program called Chimpeon and it worked as it should there so i thought how hard can it be to make a trigger bot using pixel scan!

    Everything is working besides the Sendinput
    I have tried everything not even joking... I have been stuck at the same place for over 3 hours now... I only need to make it should when it detects the right color.

    Im not hooking anything into the game as that would get people banned and i think it should work without a hook as Chimpeon is a simple key presser program so why shouldn`t it work with just the normal SendInput ?


    Code:
    // PaladinsTriggerBot.cpp : Defines the entry point for the console application.
    //
     
    #include "stdafx.h"
    #include "Windows.h"
    #include <iostream>
    #include <string>
    #include <sstream>
    #include <ctime>
     
     
     
    LPCSTR gameWindow = "Paladins (32-bit, DX11)";
    HWND hwnd;
     
     
    void Shoot() {
    	std::cout << "HEY!"<< std::endl;
    	
     
    }
     
    void Detect() {
    	
    	COLORREF colorPixel;
     
    	DWORD foundTarget = 4210942;
     
    	POINT p;
    	HDC hDC = GetDC(0);
    	int x, y;
     
    	while (!GetAsyncKeyState(VK_INSERT))
    	{
     
    		x = 1920;
    		y = 1080;
     
    		//x = 3840;
    		//y = 2160;
    		
    		colorPixel = GetPixel(hDC, x, y);
    	    std::cout << x << " " << y << " " << GetPixel(hDC, x, y) << std::endl;
    		std::cout << colorPixel << std::endl;
    		if (colorPixel == foundTarget) {
     
     
    			//mouse_event(MOUSEEVENTF_LEFTDOWN , 0, 0, 0, 0);
    			//PostMessage(hwnd, WM_LBUTTONDOWN, 0, MAKELPARAM(1920, 1080));
     
    			//PostMessage((HWND)hwnd, WM_LBUTTONDBLCLK, MK_LBUTTON, 0);
    			/*
    			INPUT    Input = { 0 };													// Create our input.
     
    			Input.type = INPUT_MOUSE;									// Let input know we are using the mouse.
    			Input.mi.dwFlags = VK_LBUTTON;							// We are setting left mouse button down.
    			SendInput(1, &Input, sizeof(INPUT));								// Send the input.
     
    			ZeroMemory(&Input, sizeof(INPUT));									// Fills a block of memory with zeros.
    			Input.type = INPUT_MOUSE;									// Let input know we are using the mouse.
    			Input.mi.dwFlags = WM_LBUTTONDOWN;								// We are setting left mouse button up.
    			SendInput(1, &Input, sizeof(INPUT));								// Send the input.
     
    			*/
     
    		}
    		Sleep(150);
    	}
    	ReleaseDC(0, hDC);
    }
     
     
    int main()
    {
    	hwnd = FindWindowA(NULL, gameWindow);
    	std::cout << "Welcome to XXXXXX triggerbot for Paladins!" << std::endl;
    	std::cout << "Please hold on while we get the triggerbot ready for you!" << std::endl;
    	Sleep(200);
    	while (!GetAsyncKeyState(VK_INSERT))
    	{
     
    		Detect();
    	}
     
    	return 0;
    }

    I know my code is a mess but i have tried my best for one of my first C++ programs/consoles.

    If someone knows how i can fix this send mouse input please tell me as im gonna go insane in a few hours if this keep on fucking with me

    Thanks for reading!

  2. #2
    gerherhtherherdhher's Avatar
    Join Date
    Dec 2015
    Gender
    male
    Posts
    171
    Reputation
    26
    Thanks
    900
    My Mood
    Sad
    This code is truly a mess. Professional programmers call code like this a "BFM", short for big fucking mess.

    Anyways, you spend 3 hours trying to figure out why it's not working and you haven't looked at the SendInput documentation?
    You need to use MOUSEEVENTF_RIGHTDOWN for the flags.. Also next time call GetLastError and look at the list of System error codes, that will tell you why it's not working.

Similar Threads

  1. XL Trainer EFLC mouse not working?
    By NoahPCFreak in forum Grand Theft Auto 4 (GTA4) Hacks & Cheats
    Replies: 10
    Last Post: 04-17-2019, 02:20 AM
  2. TerrainGeometry Not Working Anymore?
    By Jammy in forum WarRock - International Hacks
    Replies: 0
    Last Post: 03-16-2007, 05:31 PM
  3. why warrock not working now??
    By tolik13 in forum WarRock - International Hacks
    Replies: 4
    Last Post: 07-09-2006, 03:27 PM
  4. WPE not work
    By trekpik in forum WarRock - International Hacks
    Replies: 3
    Last Post: 07-09-2006, 10:09 AM