From http://ltfxhook.implux.com by Elb
Credit goes to:
Ltfxguy
Elb
Code:
//===================================================================================
int CanPenetrate( float *start, float *end, int power )
{
static pmtrace_t* tr = (pmtrace_t*)0x02252DF0;
float view[3];
float dir[3];
view[0] = end[0] - start[0];
view[1] = end[1] - start[1];
view[2] = end[2] - start[2];
float length = VectorLength(view);
dir[0] = view[0] / length;
dir[1] = view[1] / length;
dir[2] = view[2] / length;
float position[3];
position[0] = start[0];
position[1] = start[1];
position[2] = start[2];
tr->startsolid = true;
while( power )
{
if( !tr->startsolid )
power--;
tr = gEngfuncs.PM_TraceLine( position, end, PM_TRACELINE_PHYSENTSONLY, 2, -1);
if( tr->fraction==1.0f )
return 1;
if( tr->allsolid )
return 0;
position[0] = tr->endpos[0] + dir[0] * 8.0f;
position[1] = tr->endpos[1] + dir[1] * 8.0f;
position[2] = tr->endpos[2] + dir[2] * 8.0f;
}
return 0;
}
//==================================================
int CorrectGunX()
{
if (currentWeaponID == WEAPON_SG550 || currentWeaponID == WEAPON_G3SG1 || currentWeaponID == WEAPON_SCOUT || currentWeaponID == WEAPON_AWP)
return 3;
if (currentWeaponID == WEAPON_AUG || currentWeaponID == WEAPON_PARA || currentWeaponID == WEAPON_COLT || currentWeaponID == WEAPON_DEAGLE || currentWeaponID == WEAPON_SIG || currentWeaponID == WEAPON_AK)
return 2;
return 0;
}
//====================================================================================
int PathFree(float* from,float* to)
{
int pathtest;
pmtrace_t tr;
gEngfuncs.pEventAPI->EV_SetTraceHull( 2 );
gEngfuncs.pEventAPI->EV_PlayerTrace( from, to, PM_GLASS_IGNORE, me.ent->index, &tr );
pathtest = (tr.fraction == 1.0);
if (!pathtest && xvar.autowall && CorrectGunX())
{
pathtest = CanPenetrate(from, to, CorrectGunX());
}
return pathtest;
}
//====================================================================================
aimvec* OriginAimbot::TargetRegion(int ax)
{
vec3_t vecEnd, up, right, forward, EntViewOrg,PredOrg, playerAngles;
PredictTarget(ax,PredOrg);
vector<aimvec>::iterator si, end;
if (vPlayers[ax].getEnt()->curstate.usehull == 0)
{
si = AimVecsS.begin(); end = AimVecsS.end();
} else {
si = AimVecsD.begin(); end = AimVecsD.end();
}
playerAngles[0]=0;
playerAngles[1]=vPlayers[ax].getEnt()->angles[1];
playerAngles[2]=2;
gEngfuncs.pfnAngleVectors (playerAngles, forward, right, up);
forward[1] = -forward[2];
for (;si!=end;++si)
{
VectorCopy(PredOrg,EntViewOrg);
EntViewOrg = EntViewOrg + forward * si->f;
EntViewOrg = EntViewOrg + up * si->h;
EntViewOrg = EntViewOrg + right * si->r;
if(PathFree(me.pmEyePos,EntViewOrg)) return &(*si);
}
return NULL;
}
You forgot to say that you have to have
Code:
int CanPenetrate( float *start, float *end, int power );
int PathFree( float *from, float *to );
in aimbot.h
I got a better pathfree now
Code:
int PathFree(float* from,float* to)
{
int pathtest;
pmtrace_t tr;
gEngfuncs.pEventAPI->EV_SetTraceHull( 2 );
gEngfuncs.pEventAPI->EV_PlayerTrace( from, to, PM_GLASS_IGNORE, me.ent->index, &tr );
pathtest = (tr.fraction == 1.0);
if (!pathtest && cvar.autowall)
{
int penetration = WALL_PEN0, bullettype, damage;
float distance, wallpierce;
penetration = playerItems.CurPenetration();
bullettype = playerItems.CurBulletType();
damage = playerItems.CurDamage();
distance = playerItems.CurDistance();
wallpierce = playerItems.CurWallPierce();
pathtest = CanPenetrate(from, to, distance, penetration, bullettype, damage, wallpierce);
}
return pathtest;
}