Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Release Simple External Crosshair
#1
Simple External Crosshair


Title Says it all, It is a very good example for people who are beginners in C++ and can be used in any game since its external.

I have left Sleep(); as (33) which is most common Frames Per Second in FPS games I think. Make sure to change the RGB to your likings for different colours.

Credits:
Hell_Demon

Code:
#include <windows.h>
#include <iostream>
#include <math.h>
using namespace std;

bool crosshairon=false;
HDC ragedc = NULL;
int crosshairsize=0;
int cx=0;
int cy=0;

void CrossThread(void)
{
    while(1)
    {
        if(GetAsyncKeyState(VK_NUMPAD0)&1)
        {
            crosshairon=!crosshairon;
            ragedc = GetDC(HWND_DESKTOP);
            cx=GetSystemMetrics(SM_CXSCREEN)/2-((crosshairsize-1)/2);
            cy=GetSystemMetrics(SM_CYSCREEN)/2-((crosshairsize-1)/2);
        }
        Sleep(1);
    }
}

int main()
{
    cout<<"Crosshair size in pixels:\n";
    cin>>crosshairsize;
    if(crosshairsize%2==0)
    {
        crosshairsize+=1;
    }
    system("cls");
    cout<<"Press numpad0 to toggle the crosshair on and off\n";
    CreateThread(0,0,(LPTHREAD_START_ROUTINE)CrossThread,0,0,0);
    while(1)
    {
        if(crosshairon==true)
        {
            for(int i=0;i<crosshairsize;i++)
            {
                SetPixel(ragedc, cx+i, cy+((crosshairsize-1)/2), RGB(255,0,0));
                SetPixel(ragedc, cx+((crosshairsize-1)/2), cy+i, RGB(0,0,255));
            }

            if(crosshairon==false)
        
            for(int i=1;i<crosshairsize;i++)
            {
                SetPixel(ragedc, cx+i, cy+((crosshairsize-1)/2), RGB(0,0,0));
                SetPixel(ragedc, cx+((crosshairsize-1)/2), cy+i, RGB(0,0,0));
            }
        }
        Sleep(33);
    }
}

Thanks and +Rep If you like it. Also added the .exe file
Reply

#2
thanks but i have a question, im noob in source things but how do i activate or let the crosshair work on any game?
Reply

#3
Press numpad 0 Big Grin
Reply

#4
Thanks, i give u thanked Big Grin
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Dedicated Server External (public) IP Nerus 3 5,610 11-02-2013, 14:16
Last Post: Casper
  Help MW3 (External) Console - TeknoMW3? Strazeeh 7 8,180 10-01-2013, 21:54
Last Post: DeHEnergY
  Help MW3 (External) Console - TeknoMW3? Strazeeh 2 4,061 09-30-2013, 19:19
Last Post: surtek
  [Request] MW2 EXTERNAL CONSOLE!!! thomiromi 4 5,192 09-26-2013, 18:02
Last Post: Rendflex
  [Release] Black Ops 1 "External" Console barata 16 18,231 07-19-2013, 21:15
Last Post: Jakeyellis
  Black Ops 1 External Console meowgasm 8 9,144 07-04-2013, 00:57
Last Post: Nekochan
  [Release] Mw3 Simple External Console barata 25 21,029 06-30-2013, 16:30
Last Post: nexzhd
  [Release] Barata's REAL External Console Source C# barata 37 21,118 06-28-2013, 23:47
Last Post: barata
  Simple flyable helicopter script port, could use help! akillj 0 2,378 06-15-2013, 09:20
Last Post: akillj
  Black ops 1 External console/Dvar unlocker Jakeyellis 10 10,332 05-05-2013, 13:00
Last Post: barata

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.