[HELP] CA AIMBOT

05/09/2009 03:59 tsabboi3#1
i need help with this if anyone knows about aimbot...i been working on this till the new ca patch....and i got stuck on some errors like it wont work any more so if anyone know the problem please help


Code:
#include "CAimbot.h"
#include "sdk.h"

cCAimbot::cCAimbot( void )
{
	flBestDist = 99999.9f;
	m_nTarget = -1;
}

void cCAimbot::DropTarget( void )
{
	flBestDist = 99999.9f;
	m_nTarget = -1;
}

int	cCAimbot::iGetTarget( void )
{
	return m_nTarget;
}

void cCAimbot::MakeVector( QAngle angle, QAngle& vector ) 
{ 
	float pitch; 
	float yaw; 
	float tmp;           

	pitch	= (float)(angle[0] * M_PI/180); 
	yaw		= (float)(angle[1] * M_PI/180); 
	tmp		= (float) cos(pitch);

	vector[0] = (float) (-tmp * -cos(yaw)); 
	vector[1] = (float) (sin(yaw)*tmp);
	vector[2] = (float) -sin(pitch);
}

void cCAimbot::CalcAngle( Vector &src, Vector &dst, QAngle &angles )
{
	double delta[3] = { (src[0]-dst[0]), (src[1]-dst[1]), (src[2]-dst[2]) };
	double hyp = sqrt(delta[0]*delta[0] + delta[1]*delta[1]);

	angles[0] = (float) (atan(delta[2]/hyp) * M_RADPI);
	angles[1] = (float) (atan(delta[1]/delta[0]) * M_RADPI);
	angles[2] = 0.0f;

	if(delta[0] >= 0.0) { angles[1] += 180.0f; }
}

float cCAimbot::GetFov( QAngle angle, Vector src, Vector dst ) 
{ 
	QAngle ang,aim; 
	float fov; 

	CalcAngle(src, dst, ang); 
	MakeVector(angle, aim); 
	MakeVector(ang, ang);      

	float mag_s = sqrt((aim[0]*aim[0]) + (aim[1]*aim[1]) + (aim[2]*aim[2])); 
	float mag_d = sqrt((aim[0]*aim[0]) + (aim[1]*aim[1]) + (aim[2]*aim[2])); 

	float u_dot_v = aim[0]*ang[0] + aim[1]*ang[1] + aim[2]*ang[2]; 

	fov = acos(u_dot_v / (mag_s*mag_d)) * (180.0 / M_PI); 

	return fov; 
}
bool cCAimbot::GetVisible( Vector& vecAbsStart, Vector& vecAbsEnd, C_BaseEntity* pBaseEnt ) 
{ 
	player_info_t pinfo;
	trace_t tr;
	Ray_t ray;

	ray.Init( vecAbsStart, vecAbsEnd );
	CombatArms.m_pEnginetrace->TraceRay( ray, MASK_NPCWORLDSTATIC|CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_MONSTER|CONTENTS_WINDOW|CONTENTS_DEBRIS|CONTENTS_HITBOX, NULL, &tr );

	if ( tr.fraction > 0.97f )
		return true;

	if ( tr.m_pEnt && pBaseEnt )
	{
		if ( tr.m_pEnt->index == 0 || tr.allsolid )
			return false;

		if (( CombatArms.m_pEngine->GetPlayerInfo( tr.m_pEnt->index, &pinfo )
			|| pBaseEnt->index == tr.m_pEnt->index) && tr.fraction > 0.92)
			return true;
	}
	return false;
}

bool GetBonePosition ( int iBone, Vector& vecOrigin, QAngle qAngles, int index )
{
	if( iBone < 0 || iBone >= 20 )
		return false;

	matrix3x4_t pmatrix[MAXSTUDIOBONES];

	IClientEntity* ClientEntity = CombatArms.m_pEntList->GetClientEntity( index );

	if ( ClientEntity == NULL )
		return false;

	if ( ClientEntity->IsDormant() )
		return false;

	IClientRenderable* RenderEntity =  ClientEntity->GetClientRenderable();

	if(	RenderEntity == NULL/* nothing */ )
		return false;

	if( RenderEntity->SetupBones( pmatrix, 128, BONE_USED_BY_HITBOX, CombatArms.m_pGlobals->curtime ) == false )
		return false;

	MatrixAngles( pmatrix[ iBone ], qAngles, vecOrigin );

	return true;
}
void cCAimbot::AimAtTarget( CUserCmd* c )
{ 
	if( CombatArms.m_pEngine->IsInGame() == false 
	||	CombatArms.m_pEngine->IsHLTV() == true  
	||	CombatArms.m_pMyPlayer->BaseEnt() == NULL )
		return;

	DropTarget();
	//----------------------------------//
	player_info_t pinfo;
	QAngle* pPunchAngle = ( QAngle* )( (DWORD)CombatArms.m_pMyPlayer->BaseEnt() + 0xBB0 );
	//----------------------------------//
	//----------------------------------//
	for( int index = 1; index <= CombatARms.m_pEntList->NumberOfEntities( false ); ++index )
	{
		if ( index == CombatArms.m_pEngine->GetLocalPlayer() )
			continue;

		IClientEntity* ClientEntity = CombatArms.m_pEntList->GetClientEntity( index );

		if (	ClientEntity == NULL
			||	ClientEntity->IsDormant() )
				continue;

		CBaseEntity* pBaseEntity = ClientEntity->GetBaseEntity();
		//Get Life State
		int *lifestate = (int*) ( ( DWORD )pBaseEntity + ( DWORD )0x87 );

		if(		pBaseEntity == NULL/* nothing */
			||	pBaseEntity->IsDormant()/* not active */
			||	!(*lifestate  == LIFE_ALIVE)/* not alive */
			||	CombatARms_pEngine->GetPlayerInfo( index, &pinfo ) == false/* not a player!*/
			||	pBaseEntity->GetTeamNumber() == CombatArms.m_pMyPlayer->BaseEnt()->GetTeamNumber()/*enemy*/
			||	!GetBonePosition( 14/*Head*/, vPlayer, c->viewangles, index )
			||	GetFov( CombatArms.m_pMyPlayer->BaseEnt()->GetAbsAngles(), CombatArms.m_pMyPlayer->BaseEnt()->EyePosition(), vPlayer ) > 5.0f
			||	!GetVisible( CombatArms.m_pMyPlayer->BaseEnt()->EyePosition(), vPlayer, pBaseEntity )/* not visible */
			||	flBestDist < GetFov( CombatARms.m_pMyPlayer->BaseEnt()->GetAbsAngles(), CombatARms.m_pMyPlayer->BaseEnt()->EyePosition(), vPlayer ))
				continue;

		flBestDist = GetFov( CombatARms.m_pMyPlayer->BaseEnt()->GetAbsAngles(), CombatArms.m_pMyPlayer->BaseEnt()->EyePosition(), vPlayer );

		m_nTarget = index;
		// Calculate the delta origin
		Vector vDeltaOrigin = vPlayer - vPlayer;
		// Calculate the Latency
		float fLatency = CombatARms.m_pEngine->GetNetChannelInfo()->GetLatency( FLOW_OUTGOING );
		// Compensate the latency
		vDeltaOrigin[0] *= fLatency;
		vDeltaOrigin[1] *= fLatency;
		vDeltaOrigin[2] *= fLatency;
		//Apply the prediction
		PredictedTargetPosition = vPlayer + vDeltaOrigin;
	}
	if( m_nTarget == -1 )	
		return;

	CalcAngle( CombatArms.m_pMyPlayer->BaseEnt()->EyePosition(), PredictedTargetPosition, c->viewangles );
	//recoil
	c->viewangles.x -= (	pPunchAngle->x *2.0f	);
	c->viewangles.y -= (	pPunchAngle->y *2.0f	);
	//aimbot
	CombatArms.m_pEngine->SetViewAngles( c->viewangles );//aim
	//nospread
	float flNew[3],flOld[3];
	flOld[0] = c->viewangles[0];flOld[1] = c->viewangles[1];flOld[2] = c->viewangles[2];
	CombatArms.m_pNoSpread->GetSpreadFix( c->random_seed, flOld, flNew );
	c->viewangles[0] += flNew[0];c->viewangles[1] += flNew[1];c->viewangles[2] += flNew[2];
	DropTarget();
}
Don''t fool yourself by taking my codes and make it yours...all credits goes to me and the person who figures out my problem
05/09/2009 04:07 *Y0SHi+#2
ive been looking through and this project has no hook and u built if before a hook was added..
05/09/2009 04:10 tsabboi3#3
Quote:
Originally Posted by *Y0SHi+ View Post
ive been looking through and this project has no hook and u built if before a hook was added..
yeah i have a hook u want me to post it???


Code:
#include "SDK.h"

#define _Sleep Sleep
#define _CreateThread CreateThread
#define _GetModuleHandle GetModuleHandle
#define _GetProcAddress GetProcAddress
#define _CreateInterfaceFn CreateInterfaceFn

CClient		gClient;
CClient*	g_pHookedClient = new CClient;

_CreateInterfaceFn				g_AppSysFactory					= NULL;
_CreateInterfaceFn				ClientFactory					= NULL;
_CreateInterfaceFn				EngineFactory					= NULL;
_CreateInterfaceFn				PhysicFactory					= NULL;
_CreateInterfaceFn				FileSystemFactory				= NULL;
_CreateInterfaceFn				StudioFactory					= NULL;
_CreateInterfaceFn				MaterialFactory					= NULL;
_CreateInterfaceFn				VGUIFactory						= NULL;

void* AppSysFactory( const char* pszName, int* piRetnCode )
{
	void* lpReturn = g_AppSysFactory( pszName, piRetnCode );


	DO_ONCE
	(
		vgui::VGui_InitInterfacesList( "CLIENT", &g_AppSysFactory, 1 );

		if( vgui::VGui_InitInterfacesList("CLIENT", &g_AppSysFactory, 1) == false )
			add_log( "Failed to initialize VGUI" );

		if ( lpReturn )
		{
			if( strcmp( pszName, "VGUI_Surface030" ) )
			{
				CombatARms.m_pSurface	= (vgui::ISurface*)lpReturn; 
				add_log( "CombatArms.m_pSurface: [0x%.8X]", (DWORD)CombatArms.m_pSurface);

				CombatArms.m_pMatSurface			= ( IMatSystemSurface* )vgui::surface();
				add_log( "CombatArms.m_pMatSurface: [0x%.8X]", (DWORD)CombatArms.m_pMatSurface);
			}
		}
	);

	return ( void* )lpReturn;
}

int	__stdcall new_Init( _CreateInterfaceFn appSystemFactory, _CreateInterfaceFn physicsFactory, CGlobalVarsBase *pGlobals )
{
	g_AppSysFactory = appSystemFactory;
	CombatArms.m_pGlobals = pGlobals;

	return gClient.Init( AppSysFactory, physicsFactory, pGlobals );
}

void HookClient( void )
{
	ClientFactory		=		(_CreateInterfaceFn)	_GetProcAddress(		_GetModuleHandle("client.dll"),				"CreateInterface"	);
	EngineFactory		=		(_CreateInterfaceFn)	_GetProcAddress(		_GetModuleHandle("engine.dll"),				"CreateInterface"	);
	PhysicFactory		=		(_CreateInterfaceFn)	_GetProcAddress(		_GetModuleHandle("vphysics.dll"),			"CreateInterface"	);
	FileSystemFactory	=		(_CreateInterfaceFn)	_GetProcAddress(		_GetModuleHandle("FileSystem_Steam.dll"),	"CreateInterface"	);
	StudioFactory		=		(_CreateInterfaceFn)	_GetProcAddress(		_GetModuleHandle("StudioRender.dll"),		"CreateInterface"	);
	MaterialFactory		=		(_CreateInterfaceFn)	_GetProcAddress(		_GetModuleHandle("MaterialSystem.dll"),		"CreateInterface"	);
	VGUIFactory			=		(_CreateInterfaceFn)	_GetProcAddress(		_GetModuleHandle("vguimatsurface.dll"),		"CreateInterface"	);

	if( CombatArms.m_pClient == NULL )
	{
		CombatArms.m_pClient = (IBaseClientDLL*)ClientFactory( CLIENT_DLL_INTERFACE_VERSION , NULL );
		add_log( "CombatArms.m_pClient: [0x%.8X]", (DWORD)CombatArms.m_pClient );

		if( CombatArms.m_pClient )
		{
			DWORD dwOld			= NULL;
			DWORD dwOld1		= NULL;
			DWORD dwOld2		= NULL;

			PDWORD* m_pdwClient = (PDWORD*)ClientFactory( CLIENT_DLL_INTERFACE_VERSION , NULL );

			if ( m_pdwClient )
			{
				memcpy( (void*) &gClient,(void*)*m_pdwClient , sizeof (CClient) );
				g_pHookedClient = (CClient*)*m_pdwClient;
				add_log( "m_pdwClient: [0x%.8X] ----------> g_pHookedClient: [0x%.8X]", (DWORD)m_pdwClient, (DWORD)g_pHookedClient);

				if( g_pHookedClient )
				{
					if( VirtualProtect( (LPVOID)&g_pHookedClient->Init, 4, PAGE_EXECUTE_READWRITE, &dwOld ) )
						g_pHookedClient->Init = &new_Init;

					if( VirtualProtect( (LPVOID)&g_pHookedClient->CreateMove, 4, PAGE_EXECUTE_READWRITE, &dwOld1 ) )
						g_pHookedClient->CreateMove = &new_CreateMove;

					if( VirtualProtect( (LPVOID)&g_pHookedClient->HudUpdate, 4, PAGE_EXECUTE_READWRITE, &dwOld2 ) )
						g_pHookedClient->HudUpdate = &new_HudUpdate;

					if ( CombatArms.m_pInput == NULL )
					{
						PDWORD pdwAddress = ( PDWORD ) ((( DWORD ) gClient.CreateMove ) + 0x20 );
						PDWORD pdwTable = ( PDWORD ) *pdwAddress;
						CombatArms.m_pInput = ( CInput* ) *pdwTable;
						add_log( "CombatArms.m_pInput: [0x%.8X]", (DWORD)CombatArms.m_pInput);
					}
					if( CombatArms.m_pPrediction == NULL )
					{
						CombatArms.m_pPrediction = (IPrediction*)ClientFactory("VClientPrediction001", NULL);
						add_log( "CombatArms.m_pPrediction: [0x%.8X]", (DWORD)CombatArms_pPrediction);
					}	
					if( CombatArms.m_pEntList == NULL )
					{
						CombatARms.m_pEntList = (IClientEntityList*)ClientFactory("VClientEntityList003", NULL);
						add_log( "CombatArms.m_pEntList: [0x%.8X]", (DWORD)CombatArms.m_pEntList);
					}
				}
			}
		}
	}
	if( CombatArms.m_pEngine == NULL )
	{
		CombatArms.m_pEngine = (IVEngineClient*)EngineFactory("VEngineClient012", NULL);
		add_log( "CombatArms.m_pEngine: [0x%.8X]", (DWORD)CombatArms.m_pEngine);
	}
	if( CombatArms.m_pEnginevgui == NULL )
	{
		CombatArms.m_pEnginevgui = (IEngineVGui*)EngineFactory("VEngineVGui001", NULL);
		add_log( "CombatArms.m_pEnginevgui: [0x%.8X]", (DWORD)CombatArms.m_pEnginevgui);
	}	
	if( CombatArms.m_pEnginetrace == NULL )
	{
		CombatArms.m_pEnginetrace = (IEngineTrace*)EngineFactory("EngineTraceClient003", NULL);
		add_log( "CombatArms.m_pEnginetrace: [0x%.8X]", (DWORD)CombatArms.m_pEnginetrace);
	}
	if( CombatArms.m_pEffects == NULL )
	{
		CombatArms.m_pEffects = (IVEfx*)EngineFactory("VEngineEffects001", NULL);
		add_log( "CombatArms.m_pEffects: [0x%.8X]", (DWORD)CombatArms.m_pEffects);
	}

	if( CombatArms.m_pStudioRender == NULL )
	{
		CombatArms.m_pStudioRender = (IStudioRender *)StudioFactory(STUDIO_RENDER_INTERFACE_VERSION, NULL);
		add_log( "CombatArms.m_pStudioRender: [0x%.8X]", (DWORD)CombatArms.m_pStudioRender);
	}
	if( CombatArms.m_pFileSystem == NULL )
	{	
		CombatArms.m_pFileSystem = (IFileSystem*)FileSystemFactory("VFileSystem012", NULL);//FILESYSTEM_INTERFACE_VERSION
		add_log( "CombatArms.m_pFileSystem: [0x%.8X]", (DWORD)CombatArms.m_pFileSystem);
	}
	if( CombatArms.m_pRender == NULL )
	{
		CombatArms.m_pRender = (IVRenderView*)EngineFactory("VEngineRenderView012", NULL);//VENGINE_RENDERVIEW_INTERFACE_VERSION
		add_log( "CombatArms.m_pRender: [0x%.8X]", (DWORD)CombatArms.m_pRender);
	}
	if( CombatArms.m_pPhysicAPI == NULL )
	{
		CombatArms.m_pPhysicAPI = (IPhysicsSurfaceProps *)PhysicFactory(VPHYSICS_SURFACEPROPS_INTERFACE_VERSION, NULL);
		add_log( "CombatArms.m_pPhysicAPI: [0x%.8X]", (DWORD)CombatArms.m_pPhysicAPI);
	}

	if( CombatArms.m_pCvar == NULL )
	{
		CombatArms.m_pCvar = (ICvar *)EngineFactory(VENGINE_CVAR_INTERFACE_VERSION, NULL);
		add_log( "CombatArms.m_pCvar: [0x%.8X]", (DWORD)CombatArms.m_pCvar);
	}

	if( CombatArms.m_pModelRender == NULL )
	{
		CombatArms.m_pModelRender = (IVModelRender*)EngineFactory("VEngineModel012", NULL);//VENGINE_HUDMODEL_INTERFACE_VERSION
		add_log( "CombatArms.m_pModelRender: [0x%.8X]", (DWORD)CombatArms.m_pModelRender);
	}
	if( CombatArms.m_pMaterialSystem == NULL )
	{
		CombatArms.m_pMaterialSystem = (IMaterialSystem*)MaterialFactory("VMaterialSystem076", NULL);
		add_log( "CombatArms.m_pMaterialSystem: [0x%.8X]", (DWORD)CombatArms.m_pMaterialSystem );
	}
	if( CombatArms.m_pModelinfo == NULL )
	{
		CombatArms.m_pModelinfo	= (IVModelInfoClient*)EngineFactory( "VModelInfoClient003", NULL );
		add_log( "CombatArms.m_pModelinfo: [0x%.8X]", (DWORD)CombatArms.m_pModelinfo);
	}
	if( CombatArms.m_pDebugOverlay == NULL )
	{
		CombatArms.m_pDebugOverlay = (IVDebugOverlay*)EngineFactory( "VDebugOverlay003", NULL );
		add_log( "CombatArms.m_pDebugOverlay: [0x%.8X]", (DWORD)CombatArms.m_pDebugOverlay);
	}
	if( CombatArms.m_pGameEventManager == NULL )
	{		
		CombatArms.m_pGameEventManager = (IGameEventManager2*) EngineFactory( "GAMEEVENTSMANAGER002", NULL );
		add_log( "CombatArms.m_pGameEventManager: [0x%.8X]", (DWORD)CombatArms.m_pGameEventManager);
	}
}



DWORD dwWaitThread ( LPVOID lpArgs )
{
	HMODULE hClient = NULL; // don't init to a value to get the thread to lock if the module is loaded for 100 ms

	for ( ; hClient == NULL ; _Sleep(100) )// once there are console connect tools out we should set this down
		hClient = _GetModuleHandle("client.dll");

	HookClient();

	return 0;
}

void LaunchHookThread ( void )
{
	DWORD dwThreadID	= NULL;
	HANDLE hThread		= _CreateThread( NULL, NULL,(LPTHREAD_START_ROUTINE) dwWaitThread , NULL, NULL, &dwThreadID);
}
05/09/2009 04:11 *Y0SHi+#4
the hook needs to be in the project.
05/09/2009 04:25 tsabboi3#5
it is in the project....i ment when i finished it i got the dll and stuff and the hack i try in game it works for a bit than stops auto aimming for a while
05/09/2009 04:31 *Y0SHi+#6
either your coding has something to do with it or ur injector

But hey, can u send it to me so i can see if i can do sometihing and inform u on it
05/09/2009 05:41 tsabboi3#7
no.....i dont really trust you cause i bearly know you and you might get it to work and just forget about me and make it your aimbot.......and plus you have part of my project in the thread already so use that.....ps. i just dont want leecher of my work without permmison
05/09/2009 18:08 *Y0SHi+#8
sorry but i do not leech and im not that kind of person to hack someone i code and have many working hacks for ca atm but if u dont trust me its ok
05/10/2009 01:55 tsabboi3#9
add me on msn than we can talk [Only registered and activated users can see links. Click Here To Register...]
08/15/2009 12:31 Rikkami#10
closed