Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > General Coding
You last visited: Today at 23:47

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Pixelbot Problem

Discussion on Pixelbot Problem within the General Coding forum part of the Coders Den category.

Reply
 
Old   #1
 
CracKPod's Avatar
 
elite*gold: 0
Join Date: May 2006
Posts: 41
Received Thanks: 11
Pixelbot Problem

Hey habe a bissl an einem Pixelbot gecoded, der funktioniert auch soweit nur er scheint nie den Pixel zu finden, obwohl er da ist. Kann mal jemand bitte nachschauen ob ich was übersehen habe?

main.cpp
Code:
#include <iostream>
#include <windows.h>
#include "functions.h"

using namespace std;

int main()
{
    COLORREF Color = RGB(255,51,225); //Pixel
    POINT CursorPos[1];
    POINT Target;
    HDC Handle = GetDC(NULL);
    RECT Area;
    BOOL StartRetrieved = false;
    BOOL EndRetrieved = false;
    while(1)
    {
        Sleep(1);
        if(GetAsyncKeyState(VK_F1))
        {
            cout << "Retrieving Coordinates..." << endl;
            while(!StartRetrieved)
            {
                if(GetAsyncKeyState('S'))
                {
                    GetCursorPos(&CursorPos[0]);
                    cout << "Start Position saved!" << endl;
                    cout << CursorPos[0].x << endl << CursorPos[0].y << endl;
                    StartRetrieved = true;
                    break;
                }
            }
            while(!EndRetrieved)
            {
                if(GetAsyncKeyState('E'))
                {
                    GetCursorPos(&CursorPos[1]);
                    cout << "End Position saved!" << endl;
                    cout << CursorPos[1].x << endl << CursorPos[1].y << endl;
                    EndRetrieved = true;
                    break;
                }
            }
            Area = CreateRECT(Handle, CursorPos[0], CursorPos[1]);
            cout << "Area saved!" << endl;
            cout << Area.top << endl << Area.bottom << endl << Area.left << endl << Area.right << endl;
        }

        if(StartRetrieved && EndRetrieved)
        {
            cout << "Scanning" << endl;
            while(1)
            {
                if(GetPixelPos(Handle, Area, Color, &Target))
                {
                    cout << "Found!" << endl;
                    SetCursorPos(Target.x, Target.y);
                    MouseClick(Handle, Target);
                }
                else if(GetAsyncKeyState(VK_F2))
                    return 0;
                cout << "Not found!" << endl;
            }
        }
    }
    return 0;
}
functions.cpp
Code:
#include <windows.h>

bool GetPixelPos(HDC Handle, RECT Area, COLORREF Color, POINT *PixelPos)
{
    COLORREF Pixel;
    for(int y = Area.top;y<=Area.bottom;y++)
    {
        for(int x = Area.left;x<=Area.right;x++)
        {
            Pixel = GetPixel(Handle, x, y);
            if(Pixel == Color)
            {
                POINT PixelPos;
                PixelPos.x = x;
                PixelPos.y = y;
                return 1;
            }
        }
    }
    return 0;
}

RECT CreateRECT(HDC Handle, POINT Start, POINT End)
{
    if(End.x>Start.x)
    {
        RECT RECT;
        RECT.left = Start.x;
        RECT.top = Start.y;
        RECT.right = End.x;
        RECT.bottom = End.y;
        return RECT;
    }
    else
    {
        RECT RECT;
        RECT.left = End.x;
        RECT.top = End.y;
        RECT.right = Start.x;
        RECT.bottom = Start.y;
        return RECT;
    }
}

void MouseClick(HDC Handle, POINT Position)
{
    mouse_event(MOUSEEVENTF_LEFTDOWN, Position.x, Position.y, 0, 0);
    mouse_event(MOUSEEVENTF_LEFTUP, Position.x, Position.y, 0, 0);
}
functions.h
Code:
bool GetPixelPos(HDC Handle, RECT Area, COLORREF Color, POINT *PixelPos);
RECT CreateRECT(HDC Handle, POINT Start, POINT End);
void MouseClick(HDC Handle, POINT Position);
Sorry falls der Code ineffizient ist. Lerne C++ aktiv erst seit ca. 3 Tagen :|.
CracKPod is offline  
Old 04/12/2008, 20:36   #2
 
elite*gold: 0
Join Date: May 2005
Posts: 2,922
Received Thanks: 106
Komm mal gelegentlich in den IRC Channel von epvp oder idle da mal und hau mr_rattlz mal wenn er da ist, der hilft dir da sicher gerne.
CyRuSTheViRuS is offline  
Old 04/12/2008, 21:39   #3
 
syntex's Avatar
 
elite*gold: 46
Join Date: Mar 2006
Posts: 2,589
Received Thanks: 1,198
würde dir auch den EPVP irc channel enpgfelhenaaaaaaaa

weil mr.ratztl ist ect ut
syntex is offline  
Old 04/12/2008, 22:35   #4
 
rEdoX's Avatar
 
elite*gold: 20
Join Date: Jan 2006
Posts: 539
Received Thanks: 228
Hi,

jetzt mal auf die schnelle geraten:

Quote:
bool GetPixelPos(HDC Handle, RECT Area, COLORREF Color, POINT *PixelPos)
{
COLORREF Pixel;
for(int y = Area.top;y<=Area.bottom;y++)
{
for(int x = Area.left;x<=Area.right;x++)
{
Pixel = GetPixel(Handle, x, y);
if(Pixel == Color)
{
//Hier erstellst du eine variable, die genauso heißt wie parameter, in dem der punkt zurueck gegeben wird
/*POINT PixelPos;
PixelPos.x = x;
PixelPos.y = y;
*/

PixelPos->x = x;
PixelPos->y = y;
return 1;
}
}
}
return 0;
}
rEdoX is offline  
Reply


Similar Threads Similar Threads
Pixelbot Problem
08/08/2009 - AutoIt - 6 Replies
hallo, ich habe mich nun einigezeit mit AutoIt beschäftigt und hatte vor einen pixelbot zu schreiben. soweit so gut script ist fertig nur bewegt sich der mauszeiger nicht auf dem fenster sondern nur auf dem desktop. es sollte ein lvl bot werden der ein monster anklickt und dann die angrifstatste klickt und dies immer wiederholt. das script hab ich eigentlich schon fertig nur ich bekomms nicht hin das er in dem fenster klickt bzw sich die maus bewegt. wenn mir jemand dabei helfen könnte...
Pixelbot
06/24/2008 - Silkroad Online - 1 Replies
I´m working on a pixelbot and so far it works fine :) But moving the character seems to be hard. I could let the user save some waypoints,but if the char attacks a monster he is out of the waypoints and so the waypoints aren´t correct anymore. So does anyone know a good way to move the char? With AutoIT :)
Pixelbot
12/10/2007 - Silkroad Online - 0 Replies
hello ppl i've been searching all over this form and other forms i didn't found a free (or cracked) pixel bot:mad:, i hope some1 can help me and owja the 1 from deepblue7 doesn't work need to be payed thnx:) or tell me how to program a pixelbot with auto it or delphi thnx
C++ PixelBot
09/26/2007 - Dekaron - 2 Replies
.
Pixelbot...
12/30/2006 - Conquer Online 2 - 8 Replies
Hi all, I search on forum but I don't find how make a pixelbot and I answer if it is possible to make pixelbot in c++? thx bb



All times are GMT +1. The time now is 23:48.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.