Solved Problem with my crosshair :(

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

-Tek

Newbie
Full Member
Sep 6, 2012
29
324
0
I used Azorbix starterkit and made a crosshair, here's the part i changed to make a crosshair :

Variable n stuff :

C++:
float ScreenCenterX = 0.0f;//Horizontal Position
float ScreenCenterY = 0.0f;//Vertical Position
bool xhair = false;
D3DCOLOR redt = D3DCOLOR_XRGB( 255, 0, 0 );
In Setviewport :
C++:
HRESULT APIENTRY hkIDirect3DDevice9::SetViewport(CONST D3DVIEWPORT9 *pViewport) 
{
	ScreenCenterX = ( float )pViewport->Width / 2;
	ScreenCenterY = ( float )pViewport->Height / 2;
	return m_pD3Ddev->SetViewport(pViewport);
}

In Endscene :
C++:
HRESULT APIENTRY hkIDirect3DDevice9::EndScene()
{	
	
if (GetAsyncKeyState (VK_INSERT)&1)
{
xhair = !xhair;
}

if (xhair)
{ 
D3DRECT rec1 = {ScreenCenterX-25, ScreenCenterY, ScreenCenterX+ 25, ScreenCenterY+1};
D3DRECT rec2 = {ScreenCenterX, ScreenCenterY-25, ScreenCenterX+ 1,ScreenCenterY+25};
m_pD3Ddev->Clear( 1, &rec1, D3DCLEAR_TARGET, D3DXCOLOR(1.0, 0.0, 0.0, 1.0), 0, 0 );//red
m_pD3Ddev->Clear( 1, &rec2, D3DCLEAR_TARGET, D3DXCOLOR(1.0, 0.0, 0.0, 1.0), 0, 0 );


D3DRECT rec3 = {ScreenCenterX-15, ScreenCenterY, ScreenCenterX+ 15, ScreenCenterY+1};
D3DRECT rec4 = {ScreenCenterX, ScreenCenterY-15, ScreenCenterX+ 1,ScreenCenterY+15};
m_pD3Ddev->Clear( 1, &rec3, D3DCLEAR_TARGET, D3DXCOLOR(0.0, 0.0, 0.0, 0.0), 0, 0 );// black
m_pD3Ddev->Clear( 1, &rec4, D3DCLEAR_TARGET, D3DXCOLOR(0.0, 0.0, 0.0, 0.0), 0, 0 );

D3DRECT rec5 = {ScreenCenterX-3, ScreenCenterY, ScreenCenterX+ 3, ScreenCenterY+1};
D3DRECT rec6 = {ScreenCenterX, ScreenCenterY-3, ScreenCenterX+ 1,ScreenCenterY+3};
m_pD3Ddev->Clear( 1, &rec5, D3DCLEAR_TARGET, D3DXCOLOR(1.0, 0.0, 0.0, 1.0), 0, 0 );// black
m_pD3Ddev->Clear( 1, &rec6, D3DCLEAR_TARGET, D3DXCOLOR(1.0, 0.0, 0.0, 1.0), 0, 0 );

}
	return m_pD3Ddev->EndScene();
}

I can inject it , but nothing is showing up, can you help me understanding what's the problem ?
 

brinkz

Coder
Meme Tier VIP
Sep 3, 2012
209
1,688
12
C++:
void GetCenter( LPDIRECT3DDEVICE9 pDevice )
{
    float CenterX, CenterY;
    D3DVIEWPORT9 g_ViewPort;
    pDevice->GetViewport(&g_ViewPort);
    ScreenCenterX = ( float )g_ViewPort.Width / 2;
    ScreenCenterY = ( float )g_ViewPort.Height / 2;
}

//in EndScene before drawing:
GetCenter( m_pD3Ddev );
if( xhair )
....
Should work fine.

Also your hook is bad, learn how to hook correctly
https://guidedhacking.com/threads/how-to-get-started-with-directx-9-make-your-menu-hacks.10402
 
Last edited by a moderator:

-Tek

Newbie
Full Member
Sep 6, 2012
29
324
0
C++:
void GetCenter( LPDIRECT3DDEVICE9 pDevice )
{
	float CenterX, CenterY;
	D3DVIEWPORT9 g_ViewPort;
	pDevice->GetViewport(&g_ViewPort);
	ScreenCenterX = ( float )g_ViewPort.Width / 2;
	ScreenCenterY = ( float )g_ViewPort.Height / 2;
}

//in EndScene before drawing:
GetCenter( m_pD3Ddev );
if( xhair )
....
Should work fine.

I just tried it, but nothing is showing up, and i know it inject succesfully because i have a messagebox :)
 

AlexSleyore

Coder
Full Member
Nobleman
Oct 29, 2012
100
613
1
how about you put a message box here

C++:
if (GetAsyncKeyState (VK_INSERT)&1)
{
xhair = !xhair;
MessageBoxA(NULL,"Wasnt Kidding O.o","Yo Hook Really works congrats",MB_OK);
}
 

-Tek

Newbie
Full Member
Sep 6, 2012
29
324
0
Okay so the hook isn't working as you stated it, the messagebox isn't showing :)

I used azorbix starter kit, what should i do to make a undetected hook ?
 

AlexSleyore

Coder
Full Member
Nobleman
Oct 29, 2012
100
613
1
The best way ive found is to learn a little on mid function hooking and code caves. It all depends though on what you know, and what game your hacking.
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods League of Legends Accounts