dirty suka
10-12-2009, 05:07 AM
#include <windows.h>
#include "SDK.h"
IClientEntityList * g_pEntList = NULL;
IEngineTrace * g_pEngineTrace = NULL;
IVEngineClient* g_pEngine = NULL;
IVModelInfoClient* g_pModelInfo = NULL;
CreateInterfaceFn g_ClientFactory = NULL;
CreateInterfaceFn g_EngineFactory = NULL;
void LClick()
{
INPUT inpstr;
ZeroMemory(&inpstr,sizeof(INPUT));
inpstr.type = INPUT_MOUSE;
inpstr.mi.dx = 0;
inpstr.mi.dy = 0;
inpstr.mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
SendInput(1,&inpstr,sizeof(INPUT));
inpstr.mi.dwFlags = MOUSEEVENTF_LEFTUP;
SendInput(1,&inpstr,sizeof(INPUT));
}
bool GetAim( void )
{
trace_t trace;
Ray_t ray;
ZeroMemory(&trace,sizeof(trace_t));
ZeroMemory(&ray,sizeof(Ray_t));
int iLocalIndex = g_pEngine->GetLocalPlayer();
if ( iLocalIndex <= 0 )
return 0;
IClientEntity* pClientEnt = g_pEntList->GetClientEntity( iLocalIndex );
if ( !pClientEnt )
return 0;
CBaseEntity* pBaseEntity = pClientEnt->GetBaseEntity();
if ( !pBaseEntity )
return 0;
Vector vecDir;
AngleVectors( pBaseEntity->GetAbsAngles(), &vecDir );
vecDir = vecDir * 8192 + pBaseEntity->EyePosition();
Vector vecLocalPos = pBaseEntity->EyePosition();
ray.Init(vecLocalPos,vecDir);
g_pEngineTrace->TraceRay(ray,(MASK_NPCWORLDSTATIC|CONTENTS_SOLID|CONTENTS_MOVEABLE|CON TENTS_MONSTER|CONTENTS_WINDOW|CONTENTS_DEBRIS|CONTENTS_HITBOX),NULL,&trace);
if ( trace.m_pEnt )
{
if( trace.m_pEnt->IsPlayer() )
{
if(trace.m_pEnt->GetTeamNumber() != pBaseEntity->GetTeamNumber())
return true;
}
}
return 0;
}
DWORD WINAPI MainThread(LPVOID lpParameter)
{
HMODULE hmClient = GetModuleHandle( "client.dll" );
g_ClientFactory = ( CreateInterfaceFn ) GetProcAddress( hmClient, "CreateInterface" );
HMODULE hmEngine = GetModuleHandle( "engine.dll" );
g_EngineFactory = ( CreateInterfaceFn ) GetProcAddress( hmEngine, "CreateInterface" );
g_pEngineTrace = ( IEngineTrace* ) g_EngineFactory( INTERFACEVERSION_ENGINETRACE_CLIENT, NULL );
g_pModelInfo = ( IVModelInfoClient* ) g_EngineFactory( VMODELINFO_CLIENT_INTERFACE_VERSION, NULL );
g_pEngine = ( IVEngineClient* ) g_EngineFactory( VENGINE_CLIENT_INTERFACE_VERSION, NULL );
g_pEntList = ( IClientEntityList* ) g_ClientFactory( VCLIENTENTITYLIST_INTERFACE_VERSION, NULL );
if( g_pEntList&&
g_pEngineTrace&&
g_pEngine&&
g_pModelInfo)
{
// this ugly block just loops GetAim() if active is true. and toggles active with presses of c
bool active = false;
while(true)
{
Sleep(20);
if (GetAsyncKeyState('C')){
active = !active;
Sleep(100);
}
if(active)
{
if (GetAim())
LClick();
}
}
}
else
Beep(1000,1000);
return 0;
}
BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpReserved )
{
DWORD dwThreadID;
if( dwReason == 1 )
{
DisableThreadLibraryCalls(hinstDLL);
CreateThread( NULL, NULL, (LPTHREAD_START_ROUTINE)MainThread, NULL, NULL, &dwThreadID);
}
return TRUE;
}
This code compiles and runs when injected, it even detects ents and fires correctly, however, the TraceRay function will seemingly randomly after a few seconds causes all ents on the level to fall through the ground and then the game crashes to desktop.
edit: it also creates random invisible walls , as shown in my ub3r h4x video.
The code is slightly modified version of patricks Trigger bot, so cant see why it doesnt work.
As soon as i comment the TraceRay function out of the code, the crashing stops.
Im completely stumped. I really would like help, this is so fucking annoying, ive spent all sunday working on fixing this.
edit: added video so we can lol at how retarded this is :P
#include "SDK.h"
IClientEntityList * g_pEntList = NULL;
IEngineTrace * g_pEngineTrace = NULL;
IVEngineClient* g_pEngine = NULL;
IVModelInfoClient* g_pModelInfo = NULL;
CreateInterfaceFn g_ClientFactory = NULL;
CreateInterfaceFn g_EngineFactory = NULL;
void LClick()
{
INPUT inpstr;
ZeroMemory(&inpstr,sizeof(INPUT));
inpstr.type = INPUT_MOUSE;
inpstr.mi.dx = 0;
inpstr.mi.dy = 0;
inpstr.mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
SendInput(1,&inpstr,sizeof(INPUT));
inpstr.mi.dwFlags = MOUSEEVENTF_LEFTUP;
SendInput(1,&inpstr,sizeof(INPUT));
}
bool GetAim( void )
{
trace_t trace;
Ray_t ray;
ZeroMemory(&trace,sizeof(trace_t));
ZeroMemory(&ray,sizeof(Ray_t));
int iLocalIndex = g_pEngine->GetLocalPlayer();
if ( iLocalIndex <= 0 )
return 0;
IClientEntity* pClientEnt = g_pEntList->GetClientEntity( iLocalIndex );
if ( !pClientEnt )
return 0;
CBaseEntity* pBaseEntity = pClientEnt->GetBaseEntity();
if ( !pBaseEntity )
return 0;
Vector vecDir;
AngleVectors( pBaseEntity->GetAbsAngles(), &vecDir );
vecDir = vecDir * 8192 + pBaseEntity->EyePosition();
Vector vecLocalPos = pBaseEntity->EyePosition();
ray.Init(vecLocalPos,vecDir);
g_pEngineTrace->TraceRay(ray,(MASK_NPCWORLDSTATIC|CONTENTS_SOLID|CONTENTS_MOVEABLE|CON TENTS_MONSTER|CONTENTS_WINDOW|CONTENTS_DEBRIS|CONTENTS_HITBOX),NULL,&trace);
if ( trace.m_pEnt )
{
if( trace.m_pEnt->IsPlayer() )
{
if(trace.m_pEnt->GetTeamNumber() != pBaseEntity->GetTeamNumber())
return true;
}
}
return 0;
}
DWORD WINAPI MainThread(LPVOID lpParameter)
{
HMODULE hmClient = GetModuleHandle( "client.dll" );
g_ClientFactory = ( CreateInterfaceFn ) GetProcAddress( hmClient, "CreateInterface" );
HMODULE hmEngine = GetModuleHandle( "engine.dll" );
g_EngineFactory = ( CreateInterfaceFn ) GetProcAddress( hmEngine, "CreateInterface" );
g_pEngineTrace = ( IEngineTrace* ) g_EngineFactory( INTERFACEVERSION_ENGINETRACE_CLIENT, NULL );
g_pModelInfo = ( IVModelInfoClient* ) g_EngineFactory( VMODELINFO_CLIENT_INTERFACE_VERSION, NULL );
g_pEngine = ( IVEngineClient* ) g_EngineFactory( VENGINE_CLIENT_INTERFACE_VERSION, NULL );
g_pEntList = ( IClientEntityList* ) g_ClientFactory( VCLIENTENTITYLIST_INTERFACE_VERSION, NULL );
if( g_pEntList&&
g_pEngineTrace&&
g_pEngine&&
g_pModelInfo)
{
// this ugly block just loops GetAim() if active is true. and toggles active with presses of c
bool active = false;
while(true)
{
Sleep(20);
if (GetAsyncKeyState('C')){
active = !active;
Sleep(100);
}
if(active)
{
if (GetAim())
LClick();
}
}
}
else
Beep(1000,1000);
return 0;
}
BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpReserved )
{
DWORD dwThreadID;
if( dwReason == 1 )
{
DisableThreadLibraryCalls(hinstDLL);
CreateThread( NULL, NULL, (LPTHREAD_START_ROUTINE)MainThread, NULL, NULL, &dwThreadID);
}
return TRUE;
}
This code compiles and runs when injected, it even detects ents and fires correctly, however, the TraceRay function will seemingly randomly after a few seconds causes all ents on the level to fall through the ground and then the game crashes to desktop.
edit: it also creates random invisible walls , as shown in my ub3r h4x video.
The code is slightly modified version of patricks Trigger bot, so cant see why it doesnt work.
As soon as i comment the TraceRay function out of the code, the crashing stops.
Im completely stumped. I really would like help, this is so fucking annoying, ive spent all sunday working on fixing this.
edit: added video so we can lol at how retarded this is :P