Results 1 to 8 of 8
  1. #1
    lvous's Avatar
    Join Date
    Dec 2013
    Gender
    male
    Posts
    63
    Reputation
    10
    Thanks
    348

    D3D9 Pixel Aimbot

    Originally created for CSS but it works in many games if you edit model rec. I tested it in half life 2, defiance, enemy front, state of decay, ..)

    + you don't need worldtoscreen
    + only needs model rec (Stride, NumVertices, ..)

    - slow
    - wall of text

     
    download and install visual studio 2013
    download and install microsoft directx sdk june 2010
    download and install microsoft detours 1.5
    start visual studio 2013
    1. file->new project->win32 project->name your project->next->empty project->DLL->uncheck security sdl->finish
    2. project->add excisting item->Main.cpp
    3. project->add excisting item->Main.h
    4. set debug to release
    5. project -> properties -> configuration properties -> c++ -> Additional Include Directories:
    add this: C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include
    6. project -> properties -> configuration properties -> linker -> Additional Library Directories:
    add this: C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x86
    press F7 to compile your dll
    use a dll injector to inject your dll into the game


    Credits: SOH, Zoom, aBnet/UC/GD/***/Sandaasu

    Main.h
    Code:
    #define _CRT_SECURE_NO_WARNINGS
    
    #include <windows.h>
    #include <stdio.h>
    #include <d3d9.h>
    #include <d3dx9.h>
    
    #pragma comment(lib, "d3d9.lib")
    #pragma comment(lib, "d3dx9.lib")
    #include "detours/detours.h"	//detours 1.5
    
    
    #define D3DGetPixel( dwBits, scry, scrx, BPPIXEL, iPitch ) \
    	(PDWORD)( (dwBits) + ( ( (scry) * (iPitch) ) + ( (scrx) * ( (BPPIXEL) / 8 ) ) ) )
    
    #define D3D_RELEASE(D3D_PTR) if( D3D_PTR )\
    		{ D3D_PTR->Release( ); D3D_PTR	= NULL; }
    
    //#define DEBUG_STRETCHRECT
    #define TRIGGER_D3D
    #define AIM_D3D
    
    typedef struct _ENTITIES{
    	LONG X;
    	LONG Y;
    	LONG High;
    	LONG Low;
    	DWORD Count;
    }ENTITIES, *PENTITIES;
    
    /* Surface Description */
    typedef struct _D3DSURFACE_DESC_EX
    {
    	UINT			Format;
    	UINT			Type;
    	DWORD			Usage;
    	UINT			Pool;
    
    	UINT			MultiSampleType;
    	DWORD			MultiSampleQuality;
    	UINT			Width;
    	UINT			Height;
    } D3DSURFACE_DESC_EX;
    
    VOID WINAPI AimEndScene(LPDIRECT3DDEVICE9 pDev);
    VOID WINAPI AimReset(LPDIRECT3DDEVICE9 pDevice);
    BOOL WINAPI AimDrawPrim(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE Type, INT Base, UINT Min, UINT NumVertices, UINT Start, UINT PrimitiveCount);
    BOOL WINAPI GenTex(LPDIRECT3DDEVICE9 pDev, LPDIRECT3DTEXTURE9 * ppD3Dtex, DWORD Color);
    Main.cpp
    Code:
    #include "Main.h"
    
    /*
    D3D AIM 
    By: SOH
    Credits: aBnet/UC/GD/***/Sandaasu
    
    F12 - Enable remove dead bodies
    F11 - Aim through
    F10 - Choose team to target
    F9 - Choose aim spot (1 - 3)
    F8 - Increase FOV Size
    F7 - Decrease FOV Size
    F6 - Wall hack
    F5 - Enable trigger
    F4 - Enable aim
    F3 - Enable esp
    F2 - Enable fov
    F1 - Enable Draw fov
    
    Shift  - Aim key
    Trigger bot presses Mouse1 for attack... xD
    */
    
    signed int __stdcall hkReset(LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* Params);
    typedef HRESULT(__stdcall* Reset_t)(LPDIRECT3DDEVICE9, D3DPRESENT_PARAMETERS*);
    Reset_t OrigReset;
    
    signed int __stdcall hkDrawIndexedPrimitive(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE Type, INT BaseVertexIndex, UINT MinIndex, UINT NumVertices, UINT StartIndex, UINT primCount);
    typedef HRESULT(__stdcall* DrawIndexedPrimitive_t)(LPDIRECT3DDEVICE9, D3DPRIMITIVETYPE, INT, UINT, UINT, UINT, UINT);
    DrawIndexedPrimitive_t OrigDrawIndexedPrimitive;
    
    signed int __stdcall hkEndScene(LPDIRECT3DDEVICE9 pDevice);
    typedef HRESULT(__stdcall* EndScene_t)(LPDIRECT3DDEVICE9);
    EndScene_t OrigEndScene;
    
    
    D3DVIEWPORT9 D3DVP = { NULL };
    
    HRESULT __stdcall sys_DrawIndexedPrimitive(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE Type, INT BaseVertexIndex, UINT MinIndex, UINT nVertices, UINT sIndex, UINT pCount)
    {
    	AimDrawPrim(pDevice, Type, BaseVertexIndex, MinIndex, nVertices, sIndex, pCount);
    
    	return OrigDrawIndexedPrimitive(pDevice, Type, BaseVertexIndex, MinIndex, nVertices, sIndex, pCount);
    }
    
    HRESULT __stdcall sys_Reset(LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* Params)
    {
    	AimReset(pDevice);
    
    	return OrigReset(pDevice, Params);
    }
    
    HRESULT __stdcall sys_EndScene(LPDIRECT3DDEVICE9 pDevice)
    {
    	pDevice->GetViewport(&D3DVP);
    
    	AimEndScene(pDevice);
    
    	return OrigEndScene(pDevice);
    }
    
    
    #define D3DSDEX D3DSURFACE_DESC_EX
    #define D3DSD D3DSURFACE_DESC
    
    
    CHAR STR[MAX_PATH]										= {NULL};
    LONG ScreenHeightHalf									= NULL;
    LONG ScreenWidthHalf									= NULL;
    
    FLOAT FScrSizeX											= 0.0f;
    FLOAT FScrSizeY											= 0.0f;
    LONG ScrSizeX											= 0;
    LONG ScrSizeY											= 0;
    
    BOOL BDepth												= FALSE;
    BOOL BAimThr											= TRUE;
    BOOL BFiring											= FALSE;
    
    BOOL Wall												= TRUE;
    BOOL TriggerOn											= FALSE;
    BOOL AimOn												= TRUE;
    BOOL EspOn												= FALSE;
    BOOL FOVOn												= FALSE;
    BOOL FOVDrawOn											= FALSE;
    BOOL RemDeadOn											= FALSE;
    
    INT iTeam												= 1;
    DWORD TrigTime											= 0;
    INT AimSpot												= 1;
    INT FOVSize												= 150;
    
    PDWORD LabelTable										= NULL;
    PDWORD LabelBuffer										= NULL;
    PENTITIES Entities										= NULL;
    
    D3DVIEWPORT9 VP											= {NULL};
    
    LPDIRECT3DSURFACE9 pRender						= NULL;
    LPDIRECT3DSURFACE9 pStencil						= NULL;
    LPDIRECT3DSURFACE9 pAimRender					= NULL;
    LPDIRECT3DSURFACE9 pAim							= NULL;
    LPDIRECT3DSURFACE9 pOff							= NULL;
    LPDIRECT3DSURFACE9 pMapRender					= NULL;
    LPDIRECT3DSURFACE9 pVisibleRender				= NULL;
    LPDIRECT3DSURFACE9 pBlankStencil				= NULL;
    
    LPDIRECT3DSURFACE9 pTrig						= NULL;
    LPDIRECT3DSURFACE9 pTrigOff						= NULL;
    
    LPDIRECT3DSURFACE9 pVis							= NULL;
    LPDIRECT3DSURFACE9 pVisOff						= NULL;
    
    LPDIRECT3DTEXTURE9 Blue							= NULL;		
    LPDIRECT3DTEXTURE9 Red							= NULL;		
    LPDIRECT3DTEXTURE9 Green						= NULL;		
    LPDIRECT3DTEXTURE9 Orange						= NULL;	
    LPDIRECT3DTEXTURE9 Pink							= NULL;		
    LPDIRECT3DTEXTURE9 Yellow						= NULL;	
    
    //LPD3DXFONT pFont										= NULL;
    DWORD clientdll											= NULL;
    RECT FOV												= {NULL};
    
    // get pshader
    IDirect3DPixelShader9* pShader;
    UINT psData;
    
    //get vshader
    IDirect3DVertexShader9* vShader;
    UINT vsData;
    
    //models
    bool MODELS;
    
    //aimsmooth
    int aimsmooth = 3; //use 2 with low mouse sensitivity (mouse accel affects aiming, disable it if possible)
    
    VOID WINAPI CreateSurface( LPDIRECT3DDEVICE9 pDevice )
    {
    	if( !pRender || !pStencil || !pAim || !pOff || 
    		!pTrig || !pTrigOff || !pAimRender || !pMapRender || 
    			!pVisibleRender || !pBlankStencil || !pVis || !pVisOff )
    	{
    		LPDIRECT3DSURFACE9 pRen						= NULL;
    		LPDIRECT3DSURFACE9 pSten					= NULL;
    
    		FScrSizeX						= (FLOAT)VP.Width / 400.0f;
    		FScrSizeY						= (FLOAT)VP.Height / 300.0f;
    
    		ScrSizeX						= LONG((FLOAT)VP.Width / FScrSizeX);
    		ScrSizeY						= LONG((FLOAT)VP.Height / FScrSizeY);
    
    		D3DSURFACE_DESC RDESC;
    		D3DSURFACE_DESC SDESC;
    
    		memset( &RDESC, 0, sizeof(D3DSURFACE_DESC) );
    		memset( &SDESC, 0, sizeof(D3DSURFACE_DESC) );
    
    		if( pDevice->GetRenderTarget( 0, &pRen ) == D3D_OK )
    		if( pRen->GetDesc( &RDESC ) == D3D_OK )
    		{
    			if( !pRender )
    				pDevice->CreateRenderTarget( RDESC.Width, RDESC.Height,
    					D3DFMT_A8R8G8B8, RDESC.MultiSampleType, RDESC.MultiSampleQuality,
    						FALSE, &pRender, NULL);
    
    			if( !pAimRender )
    				pDevice->CreateRenderTarget( RDESC.Width, RDESC.Height,
    					D3DFMT_A8R8G8B8, RDESC.MultiSampleType, RDESC.MultiSampleQuality,
    						FALSE, &pAimRender, NULL);
    
    			if( !pMapRender )
    				pDevice->CreateRenderTarget( RDESC.Width, RDESC.Height,
    					D3DFMT_A8R8G8B8, RDESC.MultiSampleType, RDESC.MultiSampleQuality,
    						FALSE, &pMapRender, NULL);
    
    			if( !pVisibleRender )
    				pDevice->CreateRenderTarget( RDESC.Width, RDESC.Height,
    					D3DFMT_A8R8G8B8, RDESC.MultiSampleType, RDESC.MultiSampleQuality,
    						FALSE, &pVisibleRender, NULL);
    
    			if( !pAim )
    				pDevice->CreateRenderTarget( ScrSizeX, ScrSizeY, D3DFMT_A8R8G8B8, 
    					D3DMULTISAMPLE_NONE, 0, FALSE, &pAim, NULL);
    
    			if( !pVis )
    				pDevice->CreateRenderTarget( ScrSizeX, ScrSizeY, D3DFMT_A8R8G8B8, 
    					D3DMULTISAMPLE_NONE, 0, FALSE, &pVis, NULL);
    
    			if( !pTrig )
    				pDevice->CreateRenderTarget( 3, 3, D3DFMT_A8R8G8B8, 
    					D3DMULTISAMPLE_NONE, 0, FALSE, &pTrig, NULL);
    		}
    
    		if( pDevice->GetDepthStencilSurface( &pSten ) == D3D_OK )
    		if( pSten->GetDesc( &SDESC ) == D3D_OK )
    		{
    			if( !pStencil )
    				pDevice->CreateDepthStencilSurface( SDESC.Width, SDESC.Height,
    					SDESC.Format, SDESC.MultiSampleType, SDESC.MultiSampleQuality, 
    						FALSE, &pStencil, NULL );
    
    			if( !pBlankStencil )
    				pDevice->CreateDepthStencilSurface( SDESC.Width, SDESC.Height,
    					SDESC.Format, SDESC.MultiSampleType, SDESC.MultiSampleQuality, 
    						FALSE, &pBlankStencil, NULL );
    		}
    
    		if( !pOff )
    			pDevice->CreateOffscreenPlainSurface( ScrSizeX, ScrSizeY, 
    				D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &pOff, NULL );
    
    		if( !pTrigOff )
    			pDevice->CreateOffscreenPlainSurface( 3, 3, D3DFMT_A8R8G8B8, 
    				D3DPOOL_SYSTEMMEM, &pTrigOff, NULL );
    
    		if( !pVisOff	 )
    			pDevice->CreateOffscreenPlainSurface( ScrSizeX, ScrSizeY, 
    				D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &pVisOff, NULL );
    
    		D3D_RELEASE( pRen )
    		D3D_RELEASE( pSten )
    	}
    }
    
    VOID WINAPI SetDeadBodies( VOID )
    {
    	//counter strike source only
    	// cl_ragdoll_physics_enable 0
    	//if( !clientdll )
    		//clientdll							= (DWORD)GetModuleHandle( "client.dll" );
    	//else
    	//{
    		//if( RemDeadOn && *PINT(clientdll + 0x5960F0) )
    			//*PINT(clientdll + 0x5960F0)		= 0;
    	//}
    }
    
    BOOL WINAPI GetDepth( LPDIRECT3DDEVICE9 pDevice )
    {
    	if( !pStencil )
    		return FALSE;
    
    	LPDIRECT3DSURFACE9 pSten					= NULL;
    	BOOL Result												= FALSE;
    
    	if( pDevice->GetDepthStencilSurface( &pSten ) == D3D_OK )
    	{
    		if( SUCCEEDED(pDevice->StretchRect( pSten, NULL, pStencil, NULL, D3DTEXF_NONE )) )
    		{
    			if( pDevice->SetDepthStencilSurface( pStencil ) == D3D_OK )
    			{
    				pDevice->Clear( 0, NULL, D3DCLEAR_ZBUFFER , 
    						D3DCOLOR_ARGB( 0, 0, 0, 0 ), 1.0f,  0 );
    
    				pDevice->SetDepthStencilSurface( pSten );
    
    				Result			= TRUE;
    			}
    		}
    	}
    	else
    	{
    		D3D_RELEASE( pSten )
    		return FALSE;
    	}
    
    	D3D_RELEASE( pSten )
    
    	return Result;
    }
    
    BOOL WINAPI IsVisible( LPDIRECT3DDEVICE9 pDevice, LONG X, LONG Y )
    {
    	if( !pVis || !pVisOff || !pVisibleRender )
    		return FALSE;
    
    	D3DLOCKED_RECT D3DLR	= {NULL};
    	BOOL Result						= FALSE;
    	LONG Max_X						= ScrSizeX - 1;
    	LONG Max_Y						= ScrSizeY - 1;
    
    	if( X > 0 && Y > 0 && X < Max_X && Y < Max_Y )
    	{
    		if( SUCCEEDED( pVisOff->LockRect( &D3DLR, 
    			NULL, D3DLOCK_DISCARD )) )
    		{
    			PDWORD PIX		= (PDWORD)D3DGetPixel( ((DWORD)D3DLR.pBits), Y, X, 32, ( D3DLR.Pitch ) );
    
    			if( *PIX )		Result		= TRUE;
    
    			pVisOff->UnlockRect( );
    		}
    	}
    
    	return Result;
    }
    
    BOOL WINAPI VisibleReady( LPDIRECT3DDEVICE9 pDevice )
    {
    	if( !pVis || !pVisOff || !pVisibleRender )
    		return FALSE;
    
    	if( SUCCEEDED(pDevice->StretchRect( pVisibleRender, NULL, 
    		pVis, NULL, D3DTEXF_NONE )) )
    	{
    		if( SUCCEEDED(pDevice->GetRenderTargetData( pVis, pVisOff )) )
    		{
    			return TRUE;
    		}
    	}
    
    	return FALSE;
    }
    
    BOOL WINAPI Trigger( LPDIRECT3DDEVICE9 pDevice )
    {
    	if( !pTrig || !pTrigOff || !pRender )
    		return FALSE;
    
    	D3DLOCKED_RECT D3DLR	= {NULL};
    	BOOL Result		= FALSE;
    	BOOL Fire			= FALSE;
    	RECT RTR			= {ScreenWidthHalf - 1,ScreenHeightHalf - 1,
    								ScreenWidthHalf + 1,ScreenHeightHalf + 1};
    
    	if( SUCCEEDED(pDevice->StretchRect( pRender, &RTR, 
    		pTrig, NULL, D3DTEXF_NONE )) )
    	{
    		if( SUCCEEDED(pDevice->GetRenderTargetData( pTrig, pTrigOff )) )
    		{
    			if( SUCCEEDED( pTrigOff->LockRect( &D3DLR, 
    				NULL, D3DLOCK_DISCARD )) )
    			{
    				for( long y = 0;y < 3;y++ )
    				{
    					for( long x = 0;x < 3;x++ )
    					{
    						PDWORD Pixel		= D3DGetPixel( (DWORD)
    							D3DLR.pBits, y, x, 32, D3DLR.Pitch );
    
    						if( *Pixel ) Fire		= TRUE;
    					}
    				}
    				pTrigOff->UnlockRect( );
    				Result		= TRUE;
    			}
    		}
    	}
    
    	if( !( GetAsyncKeyState( VK_LBUTTON ) < 0 ) )
    	{
    		if( Fire ) 
    		{		
    			if( !BFiring )
    			{
    				mouse_event( MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 );
    				mouse_event( MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 );
    
    				TrigTime	= GetTickCount( );
    				BFiring		= TRUE;
    			}
    			else
    			{
    				DWORD Span		= GetTickCount( ) - TrigTime;
    
    				if( Span > 5 )
    				{
    					mouse_event( MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 );
    					BFiring		= FALSE;
    				}
    			}
    		}
    		else
    		{
    			if( BFiring )
    			{
    				mouse_event( MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 );
    				BFiring		= FALSE;
    			}
    		}
    	}
    
    	return Result;
    }
    
    VOID WINAPI ClearRenTarget( LPDIRECT3DDEVICE9 pDevice )
    {
    	if( pRender && pAimRender && pVisibleRender && 
    		pMapRender && pStencil && pBlankStencil )
    	{
    		LPDIRECT3DSURFACE9 pRen					= NULL;
    		LPDIRECT3DSURFACE9 pSten				= NULL;
    
    		if( pDevice->GetRenderTarget( 0, &pRen ) == D3D_OK )
    		{	
    
    #ifdef DEBUG_STRETCHRECT
    			RECT DebugA		= {(VP.Width - (VP.Width / 4)) - 10,
    										10,VP.Width - 10,VP.Height / 4 + 10};
    
    			pDevice->StretchRect( pRender, NULL, pRen, &DebugA, D3DTEXF_NONE );
    
    			RECT DebugB		= {(VP.Width - (VP.Width / 4)) - 10,
    										DebugA.bottom + 10,VP.Width - 10,(DebugA.bottom * 2) + 10};
    
    			pDevice->StretchRect( pAimRender, NULL, pRen, &DebugB, D3DTEXF_NONE );
    #endif
    
    			if( pDevice->GetDepthStencilSurface( &pSten ) == D3D_OK )
    			{
    				pDevice->SetRenderTarget( 0, pRender );
    				pDevice->SetDepthStencilSurface( pSten );
    
    				pDevice->Clear( 0, NULL, D3DCLEAR_TARGET,
    					D3DCOLOR_ARGB( 0, 0, 0, 0 ), 1.0f,  0 ); 
    
    				pDevice->SetRenderTarget( 0, pAimRender );
    				pDevice->SetDepthStencilSurface( pSten );
    
    				pDevice->Clear( 0, NULL, D3DCLEAR_TARGET, 
    					D3DCOLOR_ARGB( 0, 0, 0, 0 ), 1.0f,  0 ); 
    
    				pDevice->SetRenderTarget( 0, pVisibleRender );
    				pDevice->SetDepthStencilSurface( pSten );
    
    				pDevice->Clear( 0, NULL, D3DCLEAR_TARGET, 
    					D3DCOLOR_ARGB( 0, 0, 0, 0 ), 1.0f,  0 ); 
    
    				pDevice->SetRenderTarget( 0, pMapRender );
    				pDevice->SetDepthStencilSurface( pStencil );
    
    				pDevice->Clear( 0, NULL, D3DCLEAR_TARGET | 
    					D3DCLEAR_STENCIL | D3DCLEAR_ZBUFFER , 
    						D3DCOLOR_ARGB( 0, 0, 0, 0 ), 1.0f,  0 ); 
    
    				pDevice->SetRenderTarget( 0, pMapRender );
    				pDevice->SetDepthStencilSurface( pBlankStencil );
    
    				pDevice->Clear( 0, NULL, D3DCLEAR_STENCIL | 
    					D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB( 0, 0, 0, 0 ), 1.0f,  0 ); 
    
    				pDevice->SetRenderTarget( 0, pRen );
    				pDevice->SetDepthStencilSurface( pSten );
    			}
    		}
    
    		D3D_RELEASE( pSten )
    		D3D_RELEASE( pRen )
    	}
    }
    
    VOID WINAPI KeyState( VOID )
    {
    	if( GetAsyncKeyState( VK_F12 ) &1 )
    		if( RemDeadOn ) RemDeadOn		= FALSE;
    		else RemDeadOn							= TRUE;
    
    	if( GetAsyncKeyState( VK_F11 ) &1 )
    		if( BAimThr) BAimThr	= FALSE;
    		else BAimThr		= TRUE;
    
    	if( GetAsyncKeyState( VK_F10 ) &1 )
    		if( iTeam < 2 ) iTeam++;
    		else iTeam	= 1;
    
    	if( GetAsyncKeyState( VK_F9 ) &1 )
    		if( AimSpot < 3 ) AimSpot++;
    		else AimSpot		= 1;
    
    	if( GetAsyncKeyState( VK_F8 ) &1 )
    		if( FOVSize < ScreenHeightHalf ) FOVSize+=10;
    		else FOVSize		= 0;
    
    	if( GetAsyncKeyState( VK_F7 ) &1 )
    		if( FOVSize > 1 ) FOVSize-=10;
    		else FOVSize		= ScreenHeightHalf - 1;
    
    	if( GetAsyncKeyState( VK_F6 ) &1 )
    		if( Wall ) Wall		= FALSE;
    		else Wall			= TRUE;
    
    	if( GetAsyncKeyState( VK_F5 ) &1 )
    		if( TriggerOn ) TriggerOn		= FALSE;
    		else TriggerOn					= TRUE;
    
    	if( GetAsyncKeyState( VK_F4 ) &1 )
    		if( AimOn ) AimOn		= FALSE;
    		else AimOn					= TRUE;
    
    	if( GetAsyncKeyState( VK_F3 ) &1 )
    		if( EspOn ) EspOn		= FALSE;
    		else EspOn					= TRUE;
    
    	if( GetAsyncKeyState( VK_F2 ) &1 )
    		if( FOVOn ) FOVOn		= FALSE;
    		else FOVOn					= TRUE;
    
    	if( GetAsyncKeyState( VK_F1 ) &1 )
    		if( FOVDrawOn ) FOVDrawOn		= FALSE;
    		else FOVDrawOn							= TRUE;
    }
    
    VOID WINAPI DrawFOV( LPDIRECT3DDEVICE9 pDev )
    {
    	if( !FOVOn || !FOVDrawOn )
    		return;
    
    	DWORD BoxColor			= D3DCOLOR_ARGB( 255, 255, 20, 20 );
    	LONG X							= ScreenWidthHalf;
    	LONG Y							= ScreenHeightHalf;
    	LONG Size						= FOVSize;
    
    	D3DRECT	R1		= { X - Size, Y - Size, 
    									X + Size, Y - Size + 1 };
    
    	pDev->Clear( 1, &R1, D3DCLEAR_TARGET, BoxColor, 1.0f,  0 );
    
    	D3DRECT	R2		= { X - Size, Y + Size - 1, 
    							X + Size, Y + Size };
    
    	pDev->Clear( 1, &R2, D3DCLEAR_TARGET, BoxColor, 1.0f,  0 );
    
    	D3DRECT	R3		= { X - Size, Y - Size, 
    							X - Size + 1, Y + Size };
    
    	pDev->Clear( 1, &R3, D3DCLEAR_TARGET, BoxColor, 1.0f,  0 );
    
    	D3DRECT	R4		= { X + Size - 1, Y - Size, 
    							X + Size, Y + Size };
    
    	pDev->Clear( 1, &R4, D3DCLEAR_TARGET, BoxColor, 1.0f,  0 );
    }
    
    VOID WINAPI DrawESP( LPDIRECT3DDEVICE9 pDev, 
    					LONG X, LONG Y, LONG Size, BOOL IsVis )
    {
    	if( !EspOn )
    		return;
    
    	DWORD BoxColor			= 0;
    
    	if( !IsVis )
    		BoxColor			= D3DCOLOR_ARGB( 255, 255, 255, 20 ); // Yellow
    	else if( IsVis )
    		BoxColor			= D3DCOLOR_ARGB( 255, 20, 255, 20 ); // Green
    
    	D3DRECT	R1		= { X - Size, Y - Size, 
    									X + Size, Y - Size + 1 };
    
    	pDev->Clear( 1, &R1, D3DCLEAR_TARGET, BoxColor, 1.0f,  0 );
    
    	D3DRECT	R2		= { X - Size, Y + Size - 1, 
    							X + Size, Y + Size };
    
    	pDev->Clear( 1, &R2, D3DCLEAR_TARGET, BoxColor, 1.0f,  0 );
    
    	D3DRECT	R3		= { X - Size, Y - Size, 
    							X - Size + 1, Y + Size };
    
    	pDev->Clear( 1, &R3, D3DCLEAR_TARGET, BoxColor, 1.0f,  0 );
    
    	D3DRECT	R4		= { X + Size - 1, Y - Size, 
    							X + Size, Y + Size };
    
    	pDev->Clear( 1, &R4, D3DCLEAR_TARGET, BoxColor, 1.0f,  0 );
    }
    
    DWORD WINAPI Get2DDistance( PLONG A, PLONG B )
    {
    	LONG DistanceX		= A[0] - B[0];
    	LONG DistanceY		= A[1] - B[1];
    
    	return (DWORD)sqrt( FLOAT(( DistanceX * DistanceX ) + ( DistanceY * DistanceY )) );
    }
    
    VOID WINAPI LabelPixel( PDWORD Buffer, LONG y, LONG x, INT iLabel, INT Pitch )
    {
    	PDWORD PX			= (PDWORD)D3DGetPixel( ((DWORD)Buffer), y, x, 32, ( Pitch ) );
    	*PX						= iLabel;
    }
    
    BOOL WINAPI Aim( LPDIRECT3DDEVICE9 pDevice )
    {
    	if( !pAimRender || !pAim || !pOff )
    		return FALSE;
    
    	D3DLOCKED_RECT D3DLR	= {NULL};
    	BOOL Result							= FALSE;
    	LONG Label						= 1;
    	LONG Objects						= 0;
    	DWORD MaxDistance			= 0xFFFFFFFF;
    	LONG AimX							= 0;
    	LONG AimY							= 0;
    	LONG Max_X							= ScrSizeX;
    	LONG Max_Y							= ScrSizeY;
    	LONG PiSize							= Max_X * 4;
    
    	LONG ScreenCenter[2]			= {ScreenWidthHalf,ScreenHeightHalf};
    
    	// The maximum number of blobs is given by an image filled 
    	// with equally spaced single pixel blobs. 
    
    	if( !LabelTable )
    		LabelTable	= (PDWORD)malloc( (Max_X * Max_Y / 4) * sizeof(DWORD) );
    	else
    		memset( LabelTable, 0, (Max_X * Max_Y / 4) * sizeof(DWORD) );
    
    	if( !Entities )
    		Entities			= (PENTITIES)malloc( (Max_X * Max_Y / 4) * sizeof(PENTITIES) );
    	else
    		memset( Entities, 0, (Max_X * Max_Y / 4) * sizeof(PENTITIES) );
    
    	if( !LabelBuffer )
    		LabelBuffer		= (PDWORD)malloc( Max_X * Max_Y * 4 );
    	else
    		memset( LabelBuffer, 0, Max_X * Max_Y * 4 );
    
    	if( !LabelTable || !Entities || !LabelBuffer )
    		return FALSE;
    
    	if( SUCCEEDED(pDevice->StretchRect( pAimRender, NULL, 
    		pAim, NULL, D3DTEXF_NONE )) )
    	{
    		if( SUCCEEDED(pDevice->GetRenderTargetData( pAim, pOff )) )
    		{
    			if( SUCCEEDED( pOff->LockRect( &D3DLR, 
    				NULL, D3DLOCK_DISCARD )) )
    			{
    				for( long y = 1;y < Max_Y - 1;y++ )
    				{
    					for( long x = 1;x < Max_X - 1;x++ )
    					{
    						PDWORD PRX				= (PDWORD)D3DGetPixel( ((DWORD)D3DLR.pBits), y, x,						32, ( D3DLR.Pitch ) );
    
    						PDWORD PRA				= (PDWORD)D3DGetPixel( ((DWORD)D3DLR.pBits), (y - 1), (x - 1),		32, ( D3DLR.Pitch ) );
    						PDWORD PRB				= (PDWORD)D3DGetPixel( ((DWORD)D3DLR.pBits), (y - 1), x,				32, ( D3DLR.Pitch ) );
    						PDWORD PRC				= (PDWORD)D3DGetPixel( ((DWORD)D3DLR.pBits), (y - 1), (x + 1),	32, ( D3DLR.Pitch ) );
    						PDWORD PRD				= (PDWORD)D3DGetPixel( ((DWORD)D3DLR.pBits), y, (x - 1),				32, ( D3DLR.Pitch ) );
    						
    						PDWORD PA					= (PDWORD)D3DGetPixel( ((DWORD)LabelBuffer), (y - 1), (x - 1),		32, ( PiSize ) );
    						PDWORD PB					= (PDWORD)D3DGetPixel( ((DWORD)LabelBuffer), (y - 1), x,				32, ( PiSize ) );
    						PDWORD PC					= (PDWORD)D3DGetPixel( ((DWORD)LabelBuffer), (y - 1), (x + 1),		32, ( PiSize ) );
    						PDWORD PD					= (PDWORD)D3DGetPixel( ((DWORD)LabelBuffer), y, (x - 1),				32, ( PiSize ) );
    
    						if( *PRX )
    						{
    							if( !*PA && !*PB && !*PC && !*PD )
    							{
    								LabelPixel( LabelBuffer, y, x, Label, PiSize );
    								LabelTable[Label-1]	=	Label;
    								Label++;
    							}
    							else
    							{
    								DWORD Num		=	0xFFFFFFFF;
    
    								if( *PA && *PA <= Num )
    									Num		= *PA;
    
    								if( *PB && *PB <= Num )
    									Num		= *PB;
    
    								if( *PC && *PC <= Num )
    									Num		= *PC;
    
    								if( *PD && *PD <= Num )
    									Num		= *PD;
    
    								LabelPixel( LabelBuffer, y, x, Num, PiSize );
    
    								if( *PA )
    									LabelTable[*PA-1]	=	Num;
    
    								if( *PB )
    									LabelTable[*PB-1]	=	Num;
    
    								if( *PC )
    									LabelTable[*PC-1]	=	Num;
    
    								if( *PD )
    									LabelTable[*PD-1]	=	Num;
    							}
    						}
    					}
    				}
    
    				pOff->UnlockRect( );
    				Result		= TRUE;
    			}
    		}
    	}
    
    	if( Label > 1 )
    	{
    		for(long y = 1; y < Max_Y - 1; y++)
    		{
    			for(long x = 1; x < Max_X - 1; x++)
    			{
    				PDWORD PX					= (PDWORD)D3DGetPixel( ((DWORD)LabelBuffer), y, x, 32, ( PiSize ) );
    
    				LONG LabelData			= *PX;
    
    				if( LabelData && LabelData < Label )
    				{
    					while( 1 )
    					{
    						if( LabelData && LabelData < Label )
    						{
    							if( LabelData == LabelTable[LabelData-1] && LabelData < Label )
    								break;
    							else
    							{
    								LabelData		= LabelTable[LabelData-1];
    							}
    						}
    					}
    
    					if( y > Entities[LabelData-1].Low )
    						Entities[LabelData-1].Low			= y;
    
    					if( !Entities[LabelData-1].High )
    						Entities[LabelData-1].High		= y;
    					else
    					{
    						if( y < Entities[LabelData-1].High )
    							Entities[LabelData-1].High	= y;
    					}
    
    					*PX									= LabelData;
    					Entities[LabelData-1].X		+= x;
    					Entities[LabelData-1].Y		+= y;
    					Entities[LabelData-1].Count++;
    					Objects++;
    				}
    			}
    		}
    
    		for( LONG i = 0;i < Objects;i++ )
    		{
    			if( i >= Label )
    				break;
    
    			LONG Count						= Entities[i].Count;
    			LONG SCXY[2]					= {Entities[i].X,Entities[i].Y};
    			LONG ESPX							= Entities[i].X;
    			LONG ESPY							= Entities[i].Y;
    			LONG VDist						= 0;
    
    			if( Count && SCXY[0] && SCXY[1] )
    			{
    				if( Count > 1 )
    				{
    					SCXY[0]					/= Count;
    					SCXY[1]					/= Count; // 3: Body ( no change :DDD )
    
    					ESPX						/= Count; // ESP
    					ESPY						/= Count;
    
    					VDist						= SCXY[1] - Entities[i].High;
    
    					if( VDist )
    					{
    						if( AimSpot == 1 )
    							SCXY[1]				= (SCXY[1] - VDist) + (VDist/8); // 1: Head
    						else if( AimSpot == 2 )
    							SCXY[1]				-= (VDist/2); // 2: Chest
    					}
    				}
    
    				BOOL IsVisESP			= IsVisible( pDevice, ESPX, ESPY );
    
    				// Resizing ESP coords and drawing ESP ...
    				ESPX							= LONG((FLOAT)ESPX * FScrSizeX);
    				ESPY							= LONG((FLOAT)ESPY * FScrSizeY);
    
    				DrawESP( pDevice, ESPX, ESPY, VDist, IsVisESP );
    
    				// IsVisible before Resizing aim coords ...
    				BOOL IsVis					= IsVisible( pDevice, SCXY[0], SCXY[1] );
    
    				// Resizing aim coords here ...
    				SCXY[0]						= LONG((FLOAT)SCXY[0] * FScrSizeX);
    				SCXY[1]						= LONG((FLOAT)SCXY[1] * FScrSizeY);
    
    				DWORD Distance			= Get2DDistance( ScreenCenter, SCXY );
    
    				if( (IsVis && !BAimThr) || BAimThr )
    				{
    					if( ( SCXY[0] > FOV.left &&
    						SCXY[0] < FOV.right &&
    						SCXY[1] > FOV.top &&
    						SCXY[1] < FOV.bottom && FOVOn ) || !FOVOn )
    					{					
    						if( Distance <= MaxDistance )
    						{
    							MaxDistance		= Distance;
    							AimX					= SCXY[0];
    							AimY					= SCXY[1];
    						}
    					}
    				}
    			}
    		}
    
    		if( AimX && AimY && MaxDistance != 0xFFFFFFFF && AimOn )
    		{
    			if(GetAsyncKeyState( VK_SHIFT ) < 0 )
    			//if( ( GetAsyncKeyState( VK_LBUTTON ) < 0 )		||
    				//( GetAsyncKeyState( VK_XBUTTON1 ) < 0 )	||
    				//( GetAsyncKeyState( VK_XBUTTON2 ) < 0 ) )
    			{
    				if(AimX > ScreenWidthHalf)				AimX = +((AimX - ScreenWidthHalf)/ aimsmooth);//4
    				else if (AimX < ScreenWidthHalf)		AimX = -((ScreenWidthHalf - AimX) / aimsmooth);
    				else if(AimX == ScreenWidthHalf)		AimX = 0L;
    				if (AimY > ScreenHeightHalf)			AimY = +((AimY - ScreenHeightHalf) / aimsmooth);
    				else if (AimY < ScreenHeightHalf)		AimY = -((ScreenHeightHalf - AimY) / aimsmooth);
    				else if(AimY == ScreenHeightHalf)	AimY	= 0L;
    
    				mouse_event( MOUSEEVENTF_MOVE, 
    					AimX, AimY, NULL, NULL );
    
    			}
    		}
    	}
    
    	return Result;
    }
    
    VOID WINAPI CreateTextures( LPDIRECT3DDEVICE9 pDev )
    {
    	if( !Blue )		GenTex( pDev, &Blue, D3DCOLOR_ARGB( 255, 20, 20, 255 ) );
    	if( !Red )		GenTex( pDev, &Red, D3DCOLOR_ARGB( 255, 255, 20, 20 ) );
    	if( !Green )	GenTex( pDev, &Green, D3DCOLOR_ARGB( 255, 20, 255, 20 ) );
    	if( !Orange )	GenTex( pDev, &Orange, D3DCOLOR_ARGB( 255, 255, 128, 20 ) );
    	if( !Pink )		GenTex( pDev, &Pink, D3DCOLOR_ARGB( 255, 255, 20, 255 ) );
    	if( !Yellow )	GenTex( pDev, &Yellow, D3DCOLOR_ARGB( 255, 255, 255, 20 ) );
    }
    
    VOID WINAPI AimEndScene( LPDIRECT3DDEVICE9 pDev )
    {
    		pDev->GetViewport( &VP );
    
    		ScreenWidthHalf					=	VP.Width / 2;
    		ScreenHeightHalf					=	VP.Height / 2;
    
    		FOV.left				= ScreenWidthHalf - FOVSize;
    		FOV.top				= ScreenHeightHalf - FOVSize;
    		FOV.right			= ScreenWidthHalf + FOVSize;
    		FOV.bottom		= ScreenHeightHalf + FOVSize;
    
    		CreateSurface( pDev );
    		CreateTextures( pDev );
    		DrawFOV( pDev );
    
    		//if( !pFont )
    			//D3DXCreateFontA( pDev, 16, 0, 700, 0, 0, 1, 0, 
    				//0, DEFAULT_PITCH | FF_DONTCARE, "Calibri", &pFont );
    
    		D3DRECT CrssRctA = {ScreenWidthHalf,ScreenHeightHalf -  5,
    										ScreenWidthHalf + 1,ScreenHeightHalf + 6};
    
    		pDev->Clear( 1, &CrssRctA, D3DCLEAR_TARGET, 
    			D3DCOLOR_ARGB( 255, 255, 20, 20 ), 1.0f,  0 );
    
    		D3DRECT CrssRctB = {ScreenWidthHalf -  5,ScreenHeightHalf,
    										ScreenWidthHalf + 6,ScreenHeightHalf + 1};
    
    		pDev->Clear( 1, &CrssRctB, D3DCLEAR_TARGET,
    			D3DCOLOR_ARGB( 255, 255, 20, 20 ), 1.0f,  0 ); 
    
    #ifdef TRIGGER_D3D
    		if( TriggerOn )	Trigger( pDev );
    #endif
    
    #ifdef AIM_D3D
    		if( AimOn || EspOn )
    		{
    			if( VisibleReady( pDev ) )
    				Aim( pDev );
    		}
    #endif
    
    		if( AimOn || EspOn || TriggerOn )
    			ClearRenTarget( pDev );
    
    		KeyState( );
    		SetDeadBodies( );
    }
    
    VOID WINAPI AimReset( LPDIRECT3DDEVICE9 pDevice )
    {
    	D3D_RELEASE( pRender )
    	D3D_RELEASE( pStencil )
    	D3D_RELEASE( pAim )
    	D3D_RELEASE( pOff )
    	D3D_RELEASE( pTrig )
    	D3D_RELEASE( pTrigOff )
    	D3D_RELEASE( pAimRender )
    	D3D_RELEASE( pMapRender )
    	//D3D_RELEASE( pFont )
    	D3D_RELEASE( pVisibleRender )
    	D3D_RELEASE( pBlankStencil )
    	D3D_RELEASE( pVis )
    	D3D_RELEASE( pVisOff )
    
    	D3D_RELEASE( Blue )		
    	D3D_RELEASE( Red )		
    	D3D_RELEASE( Green )		
    	D3D_RELEASE( Orange )	
    	D3D_RELEASE( Pink )		
    	D3D_RELEASE( Yellow )	
    }
    
    BOOL WINAPI AimDrawPrim( LPDIRECT3DDEVICE9 pDevice, 
    	D3DPRIMITIVETYPE Type, INT Base, UINT Min, UINT NumVertices, 
    		UINT Start, UINT PrimitiveCount )
    {
    	if( !pMapRender		|| !pStencil			|| !pVisibleRender	|| !pRender		|| 
    		!pAimRender		|| !pBlankStencil		|| !Red				|| !Blue		|| 
    		!Orange			|| !Green				|| !Pink			|| !Yellow )
    		return FALSE;
    
    	LPDIRECT3DVERTEXBUFFER9 Stream		= NULL;
    	UINT Offset			= 0;
    	UINT Stride			= 0;
    	BOOL TeamTE			= FALSE;
    	BOOL TeamCTE		= FALSE;
    	BOOL TeamC4			= FALSE;
    
    	if( pDevice->GetStreamSource( 0, &Stream, &Offset, &Stride ) == D3D_OK )
    		Stream->Release( );
    
    	//get psdata
    	if (SUCCEEDED(pDevice->GetPixelShader(&pShader)))
    		if (pShader != NULL)
    			if (SUCCEEDED(pShader->GetFunction(NULL, &psData)))
    				if (pShader != NULL){ pShader->Release(); pShader = NULL; }
    
    	//get vsdata
    	if (SUCCEEDED(pDevice->GetVertexShader(&vShader)))
    		if (vShader != NULL)
    			if (SUCCEEDED(vShader->GetFunction(NULL, &vsData)))
    				if (vShader != NULL){ vShader->Release(); vShader = NULL; }
    
    	//get models
    	if(Stride == 32) //EDIT THIS ONE
    	//half life 2 demo combine soldier
    	//if ((Stride == 32 && NumVertices == 3147 && PrimitiveCount == 3852) ||//combine 1
    	//(Stride == 32 && NumVertices == 2421 && PrimitiveCount == 3232) ||//combine 2
    	//(Stride == 32 && NumVertices == 1946 && PrimitiveCount == 2536) ||//combine 3
    	//(Stride == 32 && NumVertices == 1308 && PrimitiveCount == 1652) ||//combine 4
    	//(Stride == 32 && NumVertices == 785 && PrimitiveCount == 948)	||//combine 5
    	//(Stride == 32 && NumVertices == 275 && PrimitiveCount == 284))	//combine 6
    	//if (Stride == 88) //fallout new vegas models
    	//defiance models
    	//if((Stride == 60 && psData == 1048 && vsData == 2256) ||
    	//(Stride == 36 && psData == 752 && vsData == 1516)	||
    	//(Stride == 60 && psData == 1536 && vsData == 2340) ||
    	//(Stride == 60 && psData == 1000 && vsData == 2256))
    	//if ((Stride == 16 && vsData == 2064) ||	//enemy front eyes
    		//(Stride == 16 && vsData == 1544) ||	//heads and hands
    		//(Stride == 16 && vsData == 1996))	//bodies
    		MODELS = true;
    	else MODELS = false;
    
    	if (MODELS)
    	{
    		LPDIRECT3DSURFACE9 pRen					= NULL;
    		LPDIRECT3DSURFACE9 pSten				= NULL;
    		D3DSDEX RDESC								= {0};
    
    		if( pDevice->GetRenderTarget( 0, &pRen ) == D3D_OK )
    		{
    			if( pRen->GetDesc( (D3DSD*)&RDESC ) == D3D_OK )
    			{
    				if( RDESC.Width == VP.Width && RDESC.Height == VP.Height )
    				{
    					if( pDevice->GetDepthStencilSurface( &pSten ) == D3D_OK )
    					{
    						pDevice->SetRenderTarget( 0, pMapRender );
    						pDevice->SetDepthStencilSurface( pStencil );
    						pDevice->SetRenderState( D3DRS_ZENABLE, TRUE );
    
    						OrigDrawIndexedPrimitive(pDevice, Type, Base, Min, NumVertices, Start, PrimitiveCount);
    
    						pDevice->SetRenderTarget( 0, pRen );
    						pDevice->SetDepthStencilSurface( pSten );
    						pDevice->SetRenderState( D3DRS_ZENABLE, TRUE );
    					}
    				}
    			}
    		}
    
    		D3D_RELEASE( pRen )
    		D3D_RELEASE( pSten )
    	}
    
    	if ((iTeam == 1 && MODELS) ||
    		(iTeam == 2 && MODELS))
    	{
    		LPDIRECT3DSURFACE9 pRen					= NULL;
    		LPDIRECT3DSURFACE9 pSten				= NULL;
    		D3DSDEX RDESC								= {0};
    
    		if( pDevice->GetRenderTarget( 0, &pRen ) == D3D_OK )
    		{
    			if( pRen->GetDesc( (D3DSD*)&RDESC ) == D3D_OK )
    			{
    				if( RDESC.Width == VP.Width && RDESC.Height == VP.Height )
    				{
    					if( pDevice->GetDepthStencilSurface( &pSten ) == D3D_OK )
    					{
    						//////VISIBLE/////////////
    
    						if( !BAimThr && ( AimOn || EspOn ) )
    						{
    							pDevice->SetRenderTarget( 0, pVisibleRender );
    							pDevice->SetDepthStencilSurface( pStencil );
    							pDevice->SetRenderState( D3DRS_ZENABLE, TRUE );
    
    							OrigDrawIndexedPrimitive(pDevice, Type, Base, Min, NumVertices, Start, PrimitiveCount);
    						}
    
    						//////TRIGGER/////////////
    
    						if( TriggerOn )
    						{
    							pDevice->SetRenderTarget( 0, pRender );
    
    							if( !BAimThr )
    							{
    								pDevice->SetDepthStencilSurface( pStencil );
    								pDevice->SetRenderState( D3DRS_ZENABLE, TRUE );
    							}
    							else
    							{
    								pDevice->SetDepthStencilSurface( pBlankStencil );
    								pDevice->SetRenderState( D3DRS_ZENABLE, FALSE );
    							}
    
    							OrigDrawIndexedPrimitive(pDevice, Type, Base, Min, NumVertices, Start, PrimitiveCount);
    						}
    
    						//////AIM/ESP//////////////
    
    						if( ( AimOn || EspOn ) )
    						{
    							pDevice->SetRenderTarget( 0, pAimRender );
    							pDevice->SetDepthStencilSurface( pBlankStencil );
    							pDevice->SetRenderState( D3DRS_ZENABLE, FALSE );
    
    							OrigDrawIndexedPrimitive(pDevice, Type, Base, Min, NumVertices, Start, PrimitiveCount);
    						}
    
    						/////////////////////////////
    
    						pDevice->SetRenderTarget( 0, pRen );
    						pDevice->SetDepthStencilSurface( pSten );
    						pDevice->SetRenderState( D3DRS_ZENABLE, TRUE );
    					}
    				}
    			}
    		}
    
    		D3D_RELEASE( pSten )
    		D3D_RELEASE( pRen )
    	}
    
    	if (Wall && (MODELS))
    	{
    		pDevice->SetTexture( 0, Orange );
    
    		pDevice->SetRenderState( D3DRS_ZENABLE, FALSE );
    
    		OrigDrawIndexedPrimitive(pDevice, Type, Base, Min, NumVertices, Start, PrimitiveCount);
    
    		pDevice->SetRenderState( D3DRS_ZENABLE, TRUE );
    
    		pDevice->SetTexture( 0, Green );
    	}
    
    	return TRUE;
    }
    
    BOOL WINAPI GenTex( LPDIRECT3DDEVICE9 pDev, 
    		LPDIRECT3DTEXTURE9 * ppD3Dtex, DWORD Color )
    {
    	D3DLOCKED_RECT d3dlr				= {NULL};
    	IDirect3DTexture9 *	Temp		= NULL;
    
    	if( FAILED( pDev->CreateTexture( 100, 100, 1, 0, D3DFMT_A8R8G8B8, 
    		D3DPOOL_DEFAULT, ppD3Dtex, NULL ) ) ) 
    		return FALSE;
    
    	if( FAILED( pDev->CreateTexture( 100, 100, 1, 0, D3DFMT_A8R8G8B8, 
    		D3DPOOL_SYSTEMMEM, &Temp, NULL ) ) ) 
    	{
    		D3D_RELEASE( (*ppD3Dtex) )
    		return FALSE;
    	}
    
    	if( Temp->LockRect( 0, &d3dlr, 0, 0 ) == S_OK )
    	{
    		for( int i = 0;i < 100*100;i++ )
    			((PDWORD)d3dlr.pBits)[i]		= Color;
    
    		Temp->UnlockRect( 0 );
    
    		pDev->UpdateTexture( Temp, *ppD3Dtex );
    	}
    	else
    	{
    		D3D_RELEASE( Temp )
    		D3D_RELEASE( (*ppD3Dtex) )
    		return FALSE;
    	}
    
    	D3D_RELEASE( Temp )
    
    	return TRUE;
    }
    
    bool WINAPI bDataCompare(const BYTE* pData, const BYTE* bMask, const char* szMask)
    {
    	for (; *szMask; ++szMask, ++pData, ++bMask)
    	{
    		if (*szMask == 'x' && *pData != *bMask)
    		{
    			return false;
    		}
    	}
    	return (*szMask) == NULL;
    }
    
    DWORD WINAPI dwFindPattern(DWORD dwAddress, DWORD dwSize, BYTE* pbMask, char* szMask)
    {
    	for (DWORD i = NULL; i < dwSize; i++)
    	{
    		if (bDataCompare((BYTE*)(dwAddress + i), pbMask, szMask))
    		{
    			return (DWORD)(dwAddress + i);
    		}
    	}
    	return 0;
    }
    
    VOID WINAPI GetD3D(VOID)
    {
    	DWORD *vtbl;
    
    	// wait for the d3dx dll
    	DWORD hD3D = 0;
    	do {
    		hD3D = (DWORD)GetModuleHandleA("d3d9.dll");
    		Sleep(10);
    	} while (!hD3D);
    	DWORD adre = dwFindPattern(hD3D, 0x128000, (PBYTE)"\xC7\x06\x00\x00\x00\x00\x89\x86\x00\x00\x00\x00\x89\x86", "xx????xx????xx");
    
    	if (adre)
    	{
    		memcpy(&vtbl, (void*)(adre + 2), 4);
    
    		//ms detours 1.5
    		OrigReset = (Reset_t)DetourFunction((BYTE*)vtbl[16], (BYTE*)sys_Reset);
    		OrigDrawIndexedPrimitive = (DrawIndexedPrimitive_t)DetourFunction((BYTE*)vtbl[82], (BYTE*)sys_DrawIndexedPrimitive);
    		OrigEndScene = (EndScene_t)DetourFunction((BYTE*)vtbl[42], (BYTE*)sys_EndScene);
    	}
    }
    
    BOOL WINAPI DllMain(HINSTANCE hModule, DWORD dwReason, LPVOID lpvReserved)
    {
    	if (dwReason == DLL_PROCESS_ATTACH)
    	{
    		DisableThreadLibraryCalls(hModule);
    		CreateThread(0, 0, (LPTHREAD_START_ROUTINE)GetD3D, 0, 0, 0);
    	}
    
    	return TRUE;
    }
    Attached Images Attached Images
    Last edited by lvous; 07-05-2014 at 09:29 AM.

  2. The Following 93 Users Say Thank You to lvous For This Useful Post:

    -dan1Dabest- (01-28-2017),523177611 (07-11-2015),AceRage (06-21-2016),aek911 (10-11-2015),AeroMan (09-07-2014),akttl08 (06-24-2015),alvinlew (01-02-2015),angellhell (11-03-2015),assulat (12-06-2015),azahacking (02-14-2015),bedna55 (05-10-2020),Blhakera02 (02-07-2016),cambopost (02-14-2016),cameronisahacker (03-31-2015),CaptainHacking (07-12-2014),cengizhanzu (06-13-2016),CPLNet (06-20-2018),daxidk123 (11-04-2014),Desolatio64 (10-04-2017),dima121 (07-20-2016),dinazoe (08-30-2014),dread415 (08-31-2018),druuu (08-09-2015),drxrtg1996 (01-27-2016),dsn. (11-28-2018),Dylanokarasi (03-06-2021),EfeAhmet315 (08-29-2016),emincangener (09-17-2016),eneskalkan71 (08-10-2016),enocanx (03-05-2019),esmieskarva12 (09-29-2016),esw197836 (09-01-2014),fangfang521 (12-02-2014),fcnfgtyrjd1111 (01-17-2017),fedner17 (07-12-2015),Ferroks (09-17-2014),fiireoxen (10-11-2014),Fireval* (05-27-2017),FlamePug (06-17-2018),forones12345 (11-13-2014),freddyj123 (11-30-2014),godu1 (04-20-2019),hackizi (11-21-2016),ipass36 (09-03-2016),J2000k (07-13-2014),jan1212 (12-13-2016),JeffreyLeng (01-23-2018),kalderath (12-23-2014),Kaushalbandara (06-19-2015),kekus1337 (08-10-2017),khinchawsu (02-05-2017),kingkron09 (02-28-2023),kruly³ (08-10-2015),Lee Anh (11-27-2017),leftspace (08-23-2014),lele47245 (12-18-2020),LengLoI (10-09-2014),luis1212_ (02-16-2018),markwinzel (11-03-2020),MrCode5 (09-17-2016),MrRangerST (01-28-2020),Nero47GFX (04-25-2015),nicric1213 (08-06-2015),Ojji (09-30-2015),Oliverhack2013 (10-17-2015),organos96 (02-16-2019),papab0is (08-17-2015),parkmonovic (06-17-2016),pcmix2017 (04-09-2023),phony1 (10-19-2015),protesr (08-28-2016),pulya0790 (12-11-2018),qq776789331 (10-10-2014),RayuKnight (12-04-2014),realciro (10-25-2014),revengecommando (03-08-2019),rockcodon (11-20-2015),sadgffg (01-16-2022),saeidpsl (06-02-2018),sammycastor (09-18-2014),seregavlg83 (12-07-2018),sfront5 (07-29-2014),sky168168 (11-01-2014),souza321 (07-22-2019),swizzbeatz1901 (09-05-2014),tater7 (01-09-2016),Toxicall (01-10-2015),ufpgolden (01-14-2017),Vas5 (01-20-2019),whatevername12415 (02-08-2018),xblade2k10 (07-15-2014),xiao135140 (12-24-2015),xxisenhymxx (09-09-2014)

  3. #2
    dinazoe's Avatar
    Join Date
    May 2014
    Gender
    male
    Posts
    4
    Reputation
    10
    Thanks
    0
    Very Nice, but where do you input the strides and numvertices? Or do you run another ddl to change the colors?

  4. #3
    AeroMan's Avatar
    Join Date
    Dec 2008
    Gender
    male
    Location
    Hell
    Posts
    3,294
    Reputation
    189
    Thanks
    3,049
    My Mood
    Busy
    Sexy

  5. #4
    sdfsafdsadf's Avatar
    Join Date
    Sep 2014
    Gender
    male
    Posts
    2
    Reputation
    10
    Thanks
    0
    My Mood
    Blah
    could this work for nmrih?

  6. #5
    lvous's Avatar
    Join Date
    Dec 2013
    Gender
    male
    Posts
    63
    Reputation
    10
    Thanks
    348
    Quote Originally Posted by sdfsafdsadf View Post
    could this work for nmrih?
    yes it would, if you have stride + numverts of the models

  7. #6
    sdfsafdsadf's Avatar
    Join Date
    Sep 2014
    Gender
    male
    Posts
    2
    Reputation
    10
    Thanks
    0
    My Mood
    Blah
    Quote Originally Posted by lvous View Post
    yes it would, if you have stride + numverts of the models
    do you have steam?

  8. #7
    sdfsafdsadf's Avatar
    Join Date
    Sep 2014
    Gender
    male
    Posts
    2
    Reputation
    10
    Thanks
    0
    My Mood
    Blah
    is there a way you can make this into a dll plz?

  9. #8
    1518845196's Avatar
    Join Date
    Aug 2014
    Gender
    male
    Posts
    1
    Reputation
    10
    Thanks
    0
    It would make a low fps,How to solve?

Similar Threads

  1. [Outdated] Pixel Aimbot [WORK IN PROGRESS]
    By asqapro in forum Alliance of Valiant Arms (AVA) Coding / Source Code
    Replies: 37
    Last Post: 01-10-2014, 10:39 PM
  2. [Help Request] I need Help creating an aimbot(Pixel Aimbot)
    By loko978 in forum Alliance of Valiant Arms (AVA) Help
    Replies: 0
    Last Post: 10-05-2013, 06:08 PM
  3. [Outdated] Counter Strike Source Pixel Aimbot 100% WORKING :D [eConic Aimbot v3.5]
    By consca in forum CounterStrike (CS) 1.6 Hacks / Counter Strike: Source (CSS) Hacks
    Replies: 33
    Last Post: 06-02-2012, 10:37 AM
  4. [Outdated] eConic Applications External Material Pixel CSS Aimbot v5.1
    By consca in forum CounterStrike (CS) 1.6 Hacks / Counter Strike: Source (CSS) Hacks
    Replies: 16
    Last Post: 03-08-2012, 10:18 AM
  5. [Info] Pixel / Color Aimbot | Triggerbot
    By Voltage552 in forum Sudden Attack General
    Replies: 13
    Last Post: 03-12-2010, 06:08 PM

Tags for this Thread