[HELP] Simple Crosshair

Posts 1–5 of 5 · Page 1 of 1
[HELP] Simple Crosshair
This is my first use of DXD9. I am still a noob at DXD9.
Extracts of Crosshair code

[php]void CrossHair(LPDIRECT3DDEVICE9 pDevice, int size, int strong, D3DCOLOR lykeColor){
int lykeCenterX = GetSystemMetrics( 0 ) / 2;
int lykeCenterY = GetSystemMetrics( 1 ) / 2;

D3DRECT rec1 = { lykeCenterX- size, lykeCenterY, lykeCenterX+ size, lykeCenterY+ strong};
D3DRECT rec2 = { lykeCenterX, lykeCenterY- size, lykeCenterX+ strong,lykeCenterY+ size};
pDevice->Clear(1, &rec1, D3DCLEAR_TARGET, lykeColor, 1000, 0);
pDevice->Clear(1, &rec2, D3DCLEAR_TARGET, lykeColor, 100, 0);
}[/php]

[php] CrossHair(pDevice, 20, 2, D3DCOLOR_ARGB( 255, 255, 0, 0 ));[/php]

When i turn the Crosshair hack on VIA hotkey, Combat arms disconnects. Can somone help me code a crosshair hack and tell me why this isnt working.

Im sure there is somthing missing!!!

This was origionally made by TOPBLAST. http://www.mpgh.net/forum/207-combat...ir-source.html
I though i will learn by looking at other source codes.

Thanks in advance.
Use This
Quote Originally Posted by ac1d_buRn View Post
Globals:

[php]
float ScreenCenterX = 0.0f;//Horizontal Position
float ScreenCenterY = 0.0f;//Vertical Position
[/php]

SetViewport:

[php]
ScreenCenterX = ( float )pViewport->Width / 2;
ScreenCenterY = ( float )pViewport->Height / 2;
[/php]

Endscene:

[php]
if(xhair)
{
D3DVIEWPORT9 viewP;
pDevice->GetViewport( &viewP );
DWORD ScreenCenterX = viewP.Width / 2;
DWORD ScreenCenterY = viewP.Height / 2;

D3DRECT rec1 = {ScreenCenterX-25, ScreenCenterY, ScreenCenterX+ 25, ScreenCenterY+2};
D3DRECT rec2 = {ScreenCenterX, ScreenCenterY-25, ScreenCenterX+ 2,ScreenCenterY+25};

pDevice->Clear( 1, &rec1, D3DCLEAR_TARGET, D3DXCOLOR(1.0, 0.0, 0.0, 1.0), 0, 0 );
pDevice->Clear( 1, &rec2, D3DCLEAR_TARGET, D3DXCOLOR(1.0, 0.0, 0.0, 1.0), 0, 0 );
}
[/php]

Best crosshair to use becuase it always draws in the middle, no matter the resolution.
Dont think windowed mode affects it either (havent tried in windowed)
It's work try
thanks for that but ive figured out the problem. My base lacks Endscene and D3D hooks.
Hmm well once i tried to make a crosshair 2
it really lagged like hell the first 10 seconds and from there on it auto aim at the height of the head! ;-) So its like a sort of a Aim Help! ;-)
d3d crosshairs wont work without a d3d hook ect..
Posts 1–5 of 5 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?