-
Автор темы
- #1
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Use!
#include "../stdafx.h"
void aimbot::drop_current(void)
{
best_player = NULL;
my_current_aim._init(0,0,0);
if ( m_pCvars->aim_randomizer->GetBool() )
{
if ( used_bone_index >= 20 )
{
used_bone_index = 0;
}
else
{
used_bone_index += 1;
}
}
else
{
used_bone_index = m_pCvars->aim_point->GetInt();
}
return;
}
bool aimbot::is_aimbot_enabled(void)
{
entity_info* me = m_pEntList->get_local();
if( !me || !me->is_alive() )
{
return false;
}
if ( m_pCvars->aim_bot->GetInt() == 0 )
{
return false;
}
if ( m_pCvars->aim_dont_aim_duck->GetBool() )
{
if( chk_flags(me->Getflags(),FL_DUCKING) )
{
return false;
}
}
if ( !m_pEntList->local.has_no_ammo() )
{
return false;
}
if( !m_pCvars->aim_miscweapon->GetBool() && m_pEntList->local.has_misc_weapon() )
{
return false;
}
return
m_pCvars->aim_bot->GetInt() == 1 || //alltime
m_pCvars->aim_bot->GetInt() == 2 && KEYDOWN( 0x01 ) || //mouse 1
m_pCvars->aim_bot->GetInt() == 3 && KEYDOWN( 0x02 ) || //mouse 2
m_pCvars->aim_bot->GetInt() == 4 && KEYDOWN( 0x04 ) || //mouse 3
m_pCvars->aim_bot->GetInt() == 5 && KEYDOWN( 0x05 ) || //mouse 4
m_pCvars->aim_bot->GetInt() == 6 && KEYDOWN( 0x06 ); //mouse 5
}
entity_info* aimbot::get_first_avaiable(void)
{
entity_info* pl = NULL;
for( size_t player_index = 0; player_index < ENTITY_LIST; player_index++ )
{
//m_pExport->add_logA("player_index %i",player_index);
entity_info* pl = m_pEntList->get_entity(player_index);
if ( pl == NULL ) continue;
if ( !pl->is_a_player() ) continue;
if ( pl->is_local_player() ) continue;
if ( !pl->is_updated() ) continue;
if ( !pl->is_alive() ) continue;
if ( !check(pl) ) continue;
return pl;
}
return NULL;
}
entity_info* aimbot::get_nearest(void)
{
entity_info* thatguy = get_first_avaiable();
if ( thatguy != NULL )
{
for( size_t player_index = 0; player_index < ENTITY_LIST; player_index++ )
{
//m_pExport->add_logA("player_index %i",player_index);
entity_info* pl = m_pEntList->get_entity(player_index);
if ( pl == NULL ) continue;
if ( (thatguy == pl) ) continue;
if ( !pl->is_a_player() ) continue;
if ( pl->is_local_player() ) continue;
if ( !pl->is_updated() ) continue;
if ( !pl->is_alive() ) continue;
if ( !check(pl) ) continue;
//actual guy distance bigger ?
if ( pl->get_distance() < thatguy->get_distance() )
{
return pl;
}
}
}
return thatguy;
}
entity_info* aimbot::get_nearest_fov(void)
{
entity_info* thatguy = get_first_avaiable();
if ( thatguy != NULL )
{
for( size_t player_index = 0; player_index < ENTITY_LIST; player_index++ )
{
//m_pExport->add_logA("player_index %i",player_index);
entity_info* pl = m_pEntList->get_entity(player_index);
if ( pl == NULL ) continue;
if ( (thatguy == pl) ) continue;
if ( !pl->is_a_player() ) continue;
if ( pl->is_local_player() ) continue;
if ( !pl->is_updated() ) continue;
if ( !pl->is_alive() ) continue;
if ( !check(pl) ) continue;
//is not the nearest of my crosshair
if( pl->get_fov() <= thatguy->get_fov() )
{
return pl;
}
}
}
return thatguy;
}
entity_info* aimbot::get_lower_health(void)
{
entity_info* thatguy = get_first_avaiable();
if ( thatguy != NULL )
{
for( size_t player_index = 0; player_index < ENTITY_LIST; player_index++ )
{
//m_pExport->add_logA("player_index %i",player_index);
entity_info* pl = m_pEntList->get_entity(player_index);
if ( pl == NULL ) continue;
if ( (thatguy == pl) ) continue;
if ( !pl->is_a_player() ) continue;
if ( pl->is_local_player() ) continue;
if ( !pl->is_updated() ) continue;
if ( !pl->is_alive() ) continue;
if ( !check(pl) ) continue;
//is not the low life player
if ( pl->Gethealth() <= thatguy->Gethealth() )
{
return pl;
}
}
}
return thatguy;
}
bool aimbot::search_best_player(void)
{
entity_info* me = m_pEntList->get_local();
if ( !is_aimbot_enabled()
|| me == NULL
|| me->is_alive() == false
|| best_player != NULL )
{
return false;
}
else
{
int typeval = m_pCvars->aim_at_best_player->GetInt();
if ( typeval == 0 )
{
best_player = get_first_avaiable();
return (best_player != NULL)
? true
: false;
}
else
{
if ( typeval == 1 )
{
best_player = get_nearest();
return (best_player != NULL)
? true
: false;
}
else
{
if ( typeval == 2 )
{
best_player = get_lower_health();
return (best_player != NULL)
? true
: false;
}
else
{
if ( typeval == 3 )
{
best_player = get_nearest_fov();
return (best_player != NULL)
? true
: false;
}
else
{
best_player = NULL;
return false;
}
}
}
}
}
return false;
}
bool aimbot::is_this_visible(entity_info* target)
{
entity_info* me = m_pEntList->get_local();
if ( target == NULL || me == NULL )
{
return false;
}
if ( m_pCvars->aim_thru->GetBool() )
{
return true;
}
if ( target->is_visible() )
{
return true;
}
if ( !m_pCvars->aim_autowall->GetBool() )
{
return false;
}
Vector mr = me->GetEyesPos()._Convert<Vector>( );
Vector tg = target->GetEyesPos()._Convert<Vector>( );
Ray_t ray;
ray.Init(mr,tg);
trace_t tr;
__TRY;
valve_games_interfaces::m_pEnginetrace->TraceRay(ray,MASK_NPCWORLDSTATIC|MASK_VISIBLE_AND_NPCS|MASK_SHOT,0,&tr);
__CATCH;
if( tr.fraction >= 0.97 )
{
return true;
}
if( tr.fraction <= 0.70 )
{
return false;
}
if( tr.startsolid || tr.allsolid )
{
return false;
}
surfacedata_t* pSurfaceData = NULL;
short surf = 0;
surf = tr.surface.surfaceProps;
__TRY;
pSurfaceData = valve_games_interfaces::m_pPhysicAPI->GetSurfaceData(surf);
__CATCH;
if ( pSurfaceData->game.material == 'N'/*CHAR_TEX_SAND*/
|| pSurfaceData->game.material == 'C'/*CHAR_TEX_CONCRETE*/
|| pSurfaceData->game.material == 'D'/*CHAR_TEX_DIRT*/
|| pSurfaceData->game.material == 'F'/*CHAR_TEX_FLESH*/ )
{
return false;
}
Vector View = tg - mr;
float length = View.Length();
if( length <= 0 )
{
return false;
}
// penetrate to direction!
Vector position;
position[0] = tr.endpos[0] + Vector(View / length)[0] * 8.0f;
position[1] = tr.endpos[1] + Vector(View / length)[1] * 8.0f;
position[2] = tr.endpos[2] + Vector(View / length)[2] * 8.0f;
ray.Init(mr,position);
__TRY;
valve_games_interfaces::m_pEnginetrace->TraceRay(ray,CONTENTS_SOLID|CONTENTS_GRATE|CONTENTS_HITBOX,NULL,&tr);
__CATCH;
if( tr.fraction >= 0.97 )
{
return true;
}
if( tr.fraction <= 0.70 )
{
return false;
}
if( tr.startsolid || tr.allsolid )
{
return false;
}
surf = tr.surface.surfaceProps;
__TRY;
pSurfaceData = valve_games_interfaces::m_pPhysicAPI->GetSurfaceData(surf);
__CATCH;
if ( pSurfaceData->game.material == 'N'/*CHAR_TEX_SAND*/
|| pSurfaceData->game.material == 'C'/*CHAR_TEX_CONCRETE*/
|| pSurfaceData->game.material == 'D'/*CHAR_TEX_DIRT*/
|| pSurfaceData->game.material == 'F'/*CHAR_TEX_FLESH*/ )
{
return false;
}
if( !(target->get_distance() < m_pNospread->max_weapon_dist) )
{
return false;
}
if( 10 > (m_pNospread->damage * pow((float)m_pNospread->flBulletVelocity,(float)(tr.fraction * target->get_distance()))) )
{
return false;
}
return true;
}
bool aimbot::check(entity_info* target,bool triggerbot)
{
if( target == NULL )
{
return false;
}
entity_info* me = m_pEntList->get_local();
if( me == NULL )
{
return false;
}
int t3am = me->Getteam();
int team = target->Getteam();
if( team == -1 || t3am == -1 )
{
/*error.mdl no hitbox cuz no model :(*/
return false;
}
//check if we can
if ( m_pCvars->aim_team->GetInt() != 2 )
{
if( m_pCvars->aim_team->GetInt() == 0 && (team == t3am) )
{
return false;
}
if( m_pCvars->aim_team->GetInt() == 1 && (team != t3am) )
{
return false;
}
}
// don't waste our precious bullets
if ( m_pCvars->anti_deathmatch_spawn_protect->GetBool() )
{
if ( target->Gethealth() >= 101 )
{
return false;
}
}
// don't check / that ain't needed
if ( triggerbot == false )
{
if ( m_pCvars->aim_fov->GetFloat() <= 350 )
{
if( m_pCvars->aim_fov->GetFloat() <= target->get_fov() )
{
return false;
}
}
// can hit ?
if ( !is_this_visible(target) )
{
return false;
}
}
return true;
}
void VectorNormalize_Spinbot( vector_3d &vIn, vector_3d * vOut )
{
float flLen = vIn._length();
if( flLen == 0 )
{
vOut->_init(0,0,1);
return;
}
flLen = 1 / (flLen + FLT_EPSILON);
vOut->_init(vIn.x* flLen,vIn.y* flLen,vIn.z* flLen);
}
bool aimbot::aim_trigger_bot( vector_3d& end )
{
int val = m_pCvars->aim_triggerbot->GetInt();
// we continue if we plan to draw something
if ( !val && !m_pCvars->aim_draw_bots->GetBool() )
{
return false;
}
entity_info* me = m_pEntList->get_local();
if( me == NULL )
{
return false;
}
if( me->is_alive() == false )
{
return false;
}
vector_3d
s = me->GetEyesPos();
angles_3d
v = me->GetEyesAngle();
// w/ recoil and spread k
if ( val == 3 )
{
// why so serious? :p
if( m_pCvars->aim_norecoil->GetBool() )
{
v += m_pNospread->qreco;
}
if( m_pCvars->aim_nospread->GetBool() )
{
if ( m_pCvars->aim_manual_nospread_angles->GetBool() )
{
v += m_pNospread->qsprd;
}
else
{
v -= m_pNospread->qsprd;
}
}
}
vector_3d fw,ri,up;
v._angle_vectors(&fw,&ri,&up);
Vector vStart = s._Convert<Vector>();
Vector vEnd = vector_3d (s + (fw * 8192))._Convert<Vector>();
Ray_t ray;
ray.Init(vStart,vEnd);
trace_t tr;
__TRY;
valve_games_interfaces::m_pEnginetrace->TraceRay (ray,
MASK_NPCWORLDSTATIC|MASK_VISIBLE_AND_NPCS|MASK_SHOT
/*MASK_NPCWORLDSTATIC|CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_MONSTER|CONTENTS_WINDOW|CONTENTS_DEBRIS|CONTENTS_HITBOX*/
/*CONTENTS_SOLID|CONTENTS_GRATE|CONTENTS_HITBOX*/,NULL,&tr);
__CATCH;
// to draw
end._init<Vector>(tr.endpos);
// dont go past here if you not intend to do anything else than draw
if ( !val )
{
return false;
}
if( tr.m_pEnt == NULL )
{
return false;
}
int index = tr.m_pEnt->entindex()/*index*/;
if( index < 0 )
{
return false;
}
entity_info* pl = m_pEntList->get_entity(index);
if( pl == NULL )
{
return false;
}
// dont shoot at barrels , weapons, etc...
if( pl->is_a_player() == false )
{
return false;
}
// is our enemy?
// is allowed to die?
if( check(pl,true) == false )
{
return false;
}
// not needed
// if( tr.fraction < 0.92 )
// {
// return;
// }
// this will enable aimbot / no checks
if ( val == 1 )
{
// bugged model?
int m = pl->get_max_hitboxes();
if( m == -1 )
{
return false;
}
// auto aim at that guy
// in the middle of the hitbox we point at
best_player = pl;
used_bone_index = tr.hitbox;
}
// die now thanks
return true;
}
void aimbot::spinbot( CUserCmd*cmd )
{
if( cmd == NULL )
{
return;
}
if ( !m_pCvars->aim_spinbot->GetBool() )
{
return;
}
int rand_factor = -360;
switch ( rand() % 5 )
{
case 0: rand_factor = -359.5416; break;
case 1: rand_factor = 359.5416; break;
case 2: rand_factor = -179.8137; break;
case 3: rand_factor = 179.8137; break;
case 4: rand_factor = -89.8549; break;
case 5: rand_factor = 89.8549; break;
}
angles_3d new_angles(0,0,0);
switch ( m_pCvars->aim_spinbot->GetInt() )
{
case 1:
// spin + invert view
new_angles.x = -cmd->viewangles.x;
new_angles.y = fmod(GetTickCount() / 0.001f* 360.0f, 360.0f);
new_angles.z = rand_factor;
break;
case 2:
// up / down,spin + invert view
new_angles.x = fmod(GetTickCount() / 0.001f* 60.0f, 60.0f);
new_angles.y = -cmd->viewangles.y;
new_angles.z = rand_factor;
break;
case 3:
// spin all the way out + invert view
new_angles.x = fmod(GetTickCount() / 0.001f* 60.0f, 60.0f);
new_angles.y = fmod(GetTickCount() / 0.001f* 360.0f, 360.0f);
new_angles.z = rand_factor;
break;
case 4:
// total inversion
new_angles.x = -cmd->viewangles.x;
new_angles.y = -cmd->viewangles.y;
new_angles.z = rand_factor;
break;
case 5:
// total inversion 2
new_angles.x = cmd->viewangles.x + rand_factor;
new_angles.y = cmd->viewangles.y + rand_factor;
new_angles.z = rand_factor;
break;
case 6:
// you may like pancakes?
new_angles.x = cmd->viewangles.x - rand_factor;
new_angles.y = cmd->viewangles.y + rand_factor;
new_angles.z = rand_factor;
break;
}
// current move
float forward = cmd->forwardmove;
float right = cmd->sidemove;
float up = cmd->upmove;
// untouched viewangles
angles_3d viewangles(
cmd->viewangles.x,
cmd->viewangles.y,
cmd->viewangles.z);
vector_3d viewforward, viewright, viewup;
viewangles._angle_vectors(&viewforward, &viewright, &viewup);
// put our garbage instead of viewangles
cmd->viewangles = new_angles._Convert<QAngle>();
// garbage viewangles
viewangles._init(
cmd->viewangles.x,
cmd->viewangles.y,
cmd->viewangles.z);
//------------------------------------------//
// fix walking
vector_3d aimforward, aimright, aimup;
viewangles._angle_vectors(&aimforward, &aimright, &aimup);
vector_3d vForwardNorm, vRightNorm, vUpNorm;
extern void VectorNormalize_Spinbot(vector_3d&,vector_3d*);
VectorNormalize_Spinbot(viewforward, &vForwardNorm );
VectorNormalize_Spinbot(viewright , &vRightNorm );
VectorNormalize_Spinbot(viewup , &vUpNorm );
vector_3d
fw = vForwardNorm * vector_3d(forward,forward,forward),
ri = vRightNorm * vector_3d(right,right,right),
uu = vUpNorm * vector_3d(up,up,up);
// now we walk normally
cmd->forwardmove = fw._dot_product(aimforward) + ri._dot_product(aimforward) + uu._dot_product(aimforward);
cmd->sidemove = fw._dot_product(aimright) + ri._dot_product(aimright) + uu._dot_product(aimright);
cmd->upmove = fw._dot_product(aimup) + ri._dot_product(aimup) + uu._dot_product(aimup);
}
void aimbot::aiming_doit(CUserCmd* cmd)
{
if ( cmd == NULL )
{
return;
}
if( best_player == NULL )
{
return;
}
my_current_aim = get_aim_point( best_player );
if( my_current_aim._is_zero() )
{
return;
}
entity_info* me = m_pEntList->get_local();
if( me == NULL )
{
return;
}
if( !me->is_alive() )
{
return;
}
angles_3d meyes = me->GetEyesAngle();
if( meyes._is_zero() )
{
return;
}
//aim to kill
if ( aim_at_this(meyes,my_current_aim,cmd) )
{
// if triggerbot is 3 just fix inside aimbot,
// disable it for manual shot and triggerbot
int val = m_pCvars->aim_triggerbot->GetInt();
if ( val == 3 )
{
// fix angles
extern void fix_angles( CUserCmd* cmd );
fix_angles( cmd );
}
}
}
void aimbot::aiming_time(CUserCmd* cmd)
{
drop_current();
if( cmd != NULL )
{
// normal try
bool aimat = aim_trigger_bot(my_current_aim_draw);
if ( aimat )
{
// fire then,
add_flags(cmd->buttons,IN_ATTACK);
my_current_aim = my_current_aim_draw;
}
// will directly aim?
bool got = (best_player != NULL) ? true : false;
if ( got == false )
{
__TRY;
// or we will search a poor victim :p
got = search_best_player();
__CATCH;
}
// kill him already
if ( got == true )
{
__TRY;
aiming_doit(cmd);
__CATCH;
}
}
drop_current();
}
vector_3d aimbot::get_aim_point( entity_info* pl )
{
entity_info* me = m_pEntList->get_local();
if( pl == NULL || me == NULL )
{
return vector_3d(0,0,0);
}
vector_3d aimdot(0,0,0);
switch ( m_pCvars->aim_mode->GetInt() )
{
default:
case 0:
//BONE MODE
aimdot._vector_add(pl->bone_pos(used_bone_index));
break;
case 1:
//HITBOX MODE
aimdot._vector_add(pl->hitbox_pos(used_bone_index));
break;
case 2:
//VECTOR MODE
aimdot._vector_add(pl->GetAbsOrigin());
aimdot._vector_add(vector_3d(
m_pCvars->aim_vector_x->GetFloat(),
m_pCvars->aim_vector_y->GetFloat(),
m_pCvars->aim_vector_z->GetFloat()));
uint fl = pl->Getflags();
if ( fl )
{
if( !chk_flags(fl,FL_ONGROUND) )
{
aimdot._vector_add(vector_3d(0,0,25));
}
if( chk_flags(fl,FL_DUCKING) )
{
aimdot._vector_substract(vector_3d(0,0,25));
}
}
break;
}
if( m_pCvars->misc_aimbot_position_tweak->GetBool() )
{
aimdot._vector_add( vector_3d(
m_pCvars->misc_aimbot_position_tweak_x->GetFloat(),
m_pCvars->misc_aimbot_position_tweak_y->GetFloat(),
m_pCvars->misc_aimbot_position_tweak_z->GetFloat()));
}
if ( !aimdot._is_valid() || aimdot._is_zero() )
{
return vector_3d(0,0,0);
}
// only need it if it's moving & if no speedhack
if ( (pl->Getspeed() > 0 || me->Getspeed() > 0) )
{
INetChannelInfo* ntw = valve_games_interfaces::m_pEngine->GetNetChannelInfo();
if ( ntw )
{
// get latency
uint fLatency = ntw->GetLatency( FLOW_OUTGOING );
if ( fLatency > 5 && fLatency < 500 )
{
// apply predict
aimdot._vector_ma(aimdot,1 + fLatency);
}
else
{
if ( fLatency >= 499 )
{
// apply predict
aimdot._vector_ma(aimdot,1 + 500);
}
}
}
}
//aim to kill
return aimdot;
}
bool aimbot::aim_at_this(angles_3d& your_angles, vector_3d position, CUserCmd*cmd )
{
if( cmd == NULL )
{
return false;
}
if( !position._is_valid() || position._is_zero() )
{
return false;
}
entity_info* me = m_pEntList->get_local();
if ( me == NULL )
{
return false;
}
if ( me->is_alive() == false )
{
return false;
}
vector_3d aim = position;
vector_3d eyes = me->GetEyesPos();
Vector eye = eyes._Convert<Vector>();
QAngle old = cmd->viewangles;
// get aim angles
your_angles._calculate_angle(eyes,aim);
if( !your_angles._is_valid() || your_angles._is_zero() )
{
return false;
}
// slow aim is slow.
if( m_pCvars->misc_slow_aimbot_move->GetBool() )
{
angles_3d qDelta;
qDelta._init<QAngle>(your_angles._Convert<QAngle>() - cmd->viewangles);
while(qDelta.x > 180) qDelta.x -= 360;
while(qDelta.y > 180) qDelta.y -= 360;
while(qDelta.z > 180) qDelta.z -= 360;
while(qDelta.x < -180) qDelta.x += 360;
while(qDelta.y < -180) qDelta.y += 360;
while(qDelta.z < -180) qDelta.z += 360;
your_angles._init<QAngle>(
cmd->viewangles + qDelta._Convert<QAngle>() / m_pCvars->misc_slow_aimbot_move->GetFloat());
while(your_angles.x > 180) your_angles.x -= 360;
while(your_angles.y > 180) your_angles.y -= 360;
while(your_angles.z > 180) your_angles.z -= 360;
while(your_angles.x < -180) your_angles.x += 360;
while(your_angles.y < -180) your_angles.y += 360;
while(your_angles.z < -180) your_angles.z += 360;
}
// set aim angles
cmd->viewangles = your_angles._Convert<QAngle>();
// silent aim (set view yes/no)
if ( !m_pCvars->aim_silent->GetBool() )
{
QAngle bak = cmd->viewangles;
QAngle rec = bak - m_pNospread->qreco._Convert<QAngle>();
// remove visual recoil on aim , or not
if ( m_pCvars->aim_norecoil->GetInt() == 2 )
{
if( m_pCvars->misc_slow_aimbot_move->GetBool() )
{
// set aim angles
rec = bak;
}
else
{
// set aim angles , and remove punch angles
rec = bak - m_pNospread->qreco._Convert<QAngle>();
}
}
else
{
// set aim angles
rec = bak;
}
// traditional aim way
valve_games_interfaces::m_pEngine->SetViewAngles(rec);
//
// // and this too, but that's clearly not needed
// valve_games_interfaces::m_pPrediction->SetViewAngles(rec);
//
// // multiple things that are supposed to do the same action
// valve_games_interfaces::m_pRender->SetMainView(eye,rec);
//
// // we'll do that also
// valve_games_interfaces::m_pClient->SetCrosshairAngle(rec);
// one of them paint black over the screen(randomly on use),
// i let you find which one of them lulz
}
//////////////////////////////////////////////////////////////////////////
// Disconnect: Kicked by Console : [zBlock] Invalid Eye-Angles Detected.
C_BaseEntity* be = me->base_entity();
if ( be != NULL )
{
if ( hl2_offsets::m_iEyeAnglesX && hl2_offsets::m_iEyeAnglesY )
{
m_pExport->SetClass_float(be,hl2_offsets::m_iEyeAnglesX,old.x);
m_pExport->SetClass_float(be,hl2_offsets::m_iEyeAnglesY,old.y);
be->OnDataChanged( DATA_UPDATE_DATATABLE_CHANGED );
}
}
if ( !m_pCvars->aim_fire->GetBool() )
{
return true;
}
//ATTACK?
add_flags(cmd->buttons,IN_ATTACK);
return true;
}
void aimbot::drop_current(void)
{
best_player = NULL;
my_current_aim._init(0,0,0);
if ( m_pCvars->aim_randomizer->GetBool() )
{
if ( used_bone_index >= 20 )
{
used_bone_index = 0;
}
else
{
used_bone_index += 1;
}
}
else
{
used_bone_index = m_pCvars->aim_point->GetInt();
}
return;
}
bool aimbot::is_aimbot_enabled(void)
{
entity_info* me = m_pEntList->get_local();
if( !me || !me->is_alive() )
{
return false;
}
if ( m_pCvars->aim_bot->GetInt() == 0 )
{
return false;
}
if ( m_pCvars->aim_dont_aim_duck->GetBool() )
{
if( chk_flags(me->Getflags(),FL_DUCKING) )
{
return false;
}
}
if ( !m_pEntList->local.has_no_ammo() )
{
return false;
}
if( !m_pCvars->aim_miscweapon->GetBool() && m_pEntList->local.has_misc_weapon() )
{
return false;
}
return
m_pCvars->aim_bot->GetInt() == 1 || //alltime
m_pCvars->aim_bot->GetInt() == 2 && KEYDOWN( 0x01 ) || //mouse 1
m_pCvars->aim_bot->GetInt() == 3 && KEYDOWN( 0x02 ) || //mouse 2
m_pCvars->aim_bot->GetInt() == 4 && KEYDOWN( 0x04 ) || //mouse 3
m_pCvars->aim_bot->GetInt() == 5 && KEYDOWN( 0x05 ) || //mouse 4
m_pCvars->aim_bot->GetInt() == 6 && KEYDOWN( 0x06 ); //mouse 5
}
entity_info* aimbot::get_first_avaiable(void)
{
entity_info* pl = NULL;
for( size_t player_index = 0; player_index < ENTITY_LIST; player_index++ )
{
//m_pExport->add_logA("player_index %i",player_index);
entity_info* pl = m_pEntList->get_entity(player_index);
if ( pl == NULL ) continue;
if ( !pl->is_a_player() ) continue;
if ( pl->is_local_player() ) continue;
if ( !pl->is_updated() ) continue;
if ( !pl->is_alive() ) continue;
if ( !check(pl) ) continue;
return pl;
}
return NULL;
}
entity_info* aimbot::get_nearest(void)
{
entity_info* thatguy = get_first_avaiable();
if ( thatguy != NULL )
{
for( size_t player_index = 0; player_index < ENTITY_LIST; player_index++ )
{
//m_pExport->add_logA("player_index %i",player_index);
entity_info* pl = m_pEntList->get_entity(player_index);
if ( pl == NULL ) continue;
if ( (thatguy == pl) ) continue;
if ( !pl->is_a_player() ) continue;
if ( pl->is_local_player() ) continue;
if ( !pl->is_updated() ) continue;
if ( !pl->is_alive() ) continue;
if ( !check(pl) ) continue;
//actual guy distance bigger ?
if ( pl->get_distance() < thatguy->get_distance() )
{
return pl;
}
}
}
return thatguy;
}
entity_info* aimbot::get_nearest_fov(void)
{
entity_info* thatguy = get_first_avaiable();
if ( thatguy != NULL )
{
for( size_t player_index = 0; player_index < ENTITY_LIST; player_index++ )
{
//m_pExport->add_logA("player_index %i",player_index);
entity_info* pl = m_pEntList->get_entity(player_index);
if ( pl == NULL ) continue;
if ( (thatguy == pl) ) continue;
if ( !pl->is_a_player() ) continue;
if ( pl->is_local_player() ) continue;
if ( !pl->is_updated() ) continue;
if ( !pl->is_alive() ) continue;
if ( !check(pl) ) continue;
//is not the nearest of my crosshair
if( pl->get_fov() <= thatguy->get_fov() )
{
return pl;
}
}
}
return thatguy;
}
entity_info* aimbot::get_lower_health(void)
{
entity_info* thatguy = get_first_avaiable();
if ( thatguy != NULL )
{
for( size_t player_index = 0; player_index < ENTITY_LIST; player_index++ )
{
//m_pExport->add_logA("player_index %i",player_index);
entity_info* pl = m_pEntList->get_entity(player_index);
if ( pl == NULL ) continue;
if ( (thatguy == pl) ) continue;
if ( !pl->is_a_player() ) continue;
if ( pl->is_local_player() ) continue;
if ( !pl->is_updated() ) continue;
if ( !pl->is_alive() ) continue;
if ( !check(pl) ) continue;
//is not the low life player
if ( pl->Gethealth() <= thatguy->Gethealth() )
{
return pl;
}
}
}
return thatguy;
}
bool aimbot::search_best_player(void)
{
entity_info* me = m_pEntList->get_local();
if ( !is_aimbot_enabled()
|| me == NULL
|| me->is_alive() == false
|| best_player != NULL )
{
return false;
}
else
{
int typeval = m_pCvars->aim_at_best_player->GetInt();
if ( typeval == 0 )
{
best_player = get_first_avaiable();
return (best_player != NULL)
? true
: false;
}
else
{
if ( typeval == 1 )
{
best_player = get_nearest();
return (best_player != NULL)
? true
: false;
}
else
{
if ( typeval == 2 )
{
best_player = get_lower_health();
return (best_player != NULL)
? true
: false;
}
else
{
if ( typeval == 3 )
{
best_player = get_nearest_fov();
return (best_player != NULL)
? true
: false;
}
else
{
best_player = NULL;
return false;
}
}
}
}
}
return false;
}
bool aimbot::is_this_visible(entity_info* target)
{
entity_info* me = m_pEntList->get_local();
if ( target == NULL || me == NULL )
{
return false;
}
if ( m_pCvars->aim_thru->GetBool() )
{
return true;
}
if ( target->is_visible() )
{
return true;
}
if ( !m_pCvars->aim_autowall->GetBool() )
{
return false;
}
Vector mr = me->GetEyesPos()._Convert<Vector>( );
Vector tg = target->GetEyesPos()._Convert<Vector>( );
Ray_t ray;
ray.Init(mr,tg);
trace_t tr;
__TRY;
valve_games_interfaces::m_pEnginetrace->TraceRay(ray,MASK_NPCWORLDSTATIC|MASK_VISIBLE_AND_NPCS|MASK_SHOT,0,&tr);
__CATCH;
if( tr.fraction >= 0.97 )
{
return true;
}
if( tr.fraction <= 0.70 )
{
return false;
}
if( tr.startsolid || tr.allsolid )
{
return false;
}
surfacedata_t* pSurfaceData = NULL;
short surf = 0;
surf = tr.surface.surfaceProps;
__TRY;
pSurfaceData = valve_games_interfaces::m_pPhysicAPI->GetSurfaceData(surf);
__CATCH;
if ( pSurfaceData->game.material == 'N'/*CHAR_TEX_SAND*/
|| pSurfaceData->game.material == 'C'/*CHAR_TEX_CONCRETE*/
|| pSurfaceData->game.material == 'D'/*CHAR_TEX_DIRT*/
|| pSurfaceData->game.material == 'F'/*CHAR_TEX_FLESH*/ )
{
return false;
}
Vector View = tg - mr;
float length = View.Length();
if( length <= 0 )
{
return false;
}
// penetrate to direction!
Vector position;
position[0] = tr.endpos[0] + Vector(View / length)[0] * 8.0f;
position[1] = tr.endpos[1] + Vector(View / length)[1] * 8.0f;
position[2] = tr.endpos[2] + Vector(View / length)[2] * 8.0f;
ray.Init(mr,position);
__TRY;
valve_games_interfaces::m_pEnginetrace->TraceRay(ray,CONTENTS_SOLID|CONTENTS_GRATE|CONTENTS_HITBOX,NULL,&tr);
__CATCH;
if( tr.fraction >= 0.97 )
{
return true;
}
if( tr.fraction <= 0.70 )
{
return false;
}
if( tr.startsolid || tr.allsolid )
{
return false;
}
surf = tr.surface.surfaceProps;
__TRY;
pSurfaceData = valve_games_interfaces::m_pPhysicAPI->GetSurfaceData(surf);
__CATCH;
if ( pSurfaceData->game.material == 'N'/*CHAR_TEX_SAND*/
|| pSurfaceData->game.material == 'C'/*CHAR_TEX_CONCRETE*/
|| pSurfaceData->game.material == 'D'/*CHAR_TEX_DIRT*/
|| pSurfaceData->game.material == 'F'/*CHAR_TEX_FLESH*/ )
{
return false;
}
if( !(target->get_distance() < m_pNospread->max_weapon_dist) )
{
return false;
}
if( 10 > (m_pNospread->damage * pow((float)m_pNospread->flBulletVelocity,(float)(tr.fraction * target->get_distance()))) )
{
return false;
}
return true;
}
bool aimbot::check(entity_info* target,bool triggerbot)
{
if( target == NULL )
{
return false;
}
entity_info* me = m_pEntList->get_local();
if( me == NULL )
{
return false;
}
int t3am = me->Getteam();
int team = target->Getteam();
if( team == -1 || t3am == -1 )
{
/*error.mdl no hitbox cuz no model :(*/
return false;
}
//check if we can
if ( m_pCvars->aim_team->GetInt() != 2 )
{
if( m_pCvars->aim_team->GetInt() == 0 && (team == t3am) )
{
return false;
}
if( m_pCvars->aim_team->GetInt() == 1 && (team != t3am) )
{
return false;
}
}
// don't waste our precious bullets
if ( m_pCvars->anti_deathmatch_spawn_protect->GetBool() )
{
if ( target->Gethealth() >= 101 )
{
return false;
}
}
// don't check / that ain't needed
if ( triggerbot == false )
{
if ( m_pCvars->aim_fov->GetFloat() <= 350 )
{
if( m_pCvars->aim_fov->GetFloat() <= target->get_fov() )
{
return false;
}
}
// can hit ?
if ( !is_this_visible(target) )
{
return false;
}
}
return true;
}
void VectorNormalize_Spinbot( vector_3d &vIn, vector_3d * vOut )
{
float flLen = vIn._length();
if( flLen == 0 )
{
vOut->_init(0,0,1);
return;
}
flLen = 1 / (flLen + FLT_EPSILON);
vOut->_init(vIn.x* flLen,vIn.y* flLen,vIn.z* flLen);
}
bool aimbot::aim_trigger_bot( vector_3d& end )
{
int val = m_pCvars->aim_triggerbot->GetInt();
// we continue if we plan to draw something
if ( !val && !m_pCvars->aim_draw_bots->GetBool() )
{
return false;
}
entity_info* me = m_pEntList->get_local();
if( me == NULL )
{
return false;
}
if( me->is_alive() == false )
{
return false;
}
vector_3d
s = me->GetEyesPos();
angles_3d
v = me->GetEyesAngle();
// w/ recoil and spread k
if ( val == 3 )
{
// why so serious? :p
if( m_pCvars->aim_norecoil->GetBool() )
{
v += m_pNospread->qreco;
}
if( m_pCvars->aim_nospread->GetBool() )
{
if ( m_pCvars->aim_manual_nospread_angles->GetBool() )
{
v += m_pNospread->qsprd;
}
else
{
v -= m_pNospread->qsprd;
}
}
}
vector_3d fw,ri,up;
v._angle_vectors(&fw,&ri,&up);
Vector vStart = s._Convert<Vector>();
Vector vEnd = vector_3d (s + (fw * 8192))._Convert<Vector>();
Ray_t ray;
ray.Init(vStart,vEnd);
trace_t tr;
__TRY;
valve_games_interfaces::m_pEnginetrace->TraceRay (ray,
MASK_NPCWORLDSTATIC|MASK_VISIBLE_AND_NPCS|MASK_SHOT
/*MASK_NPCWORLDSTATIC|CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_MONSTER|CONTENTS_WINDOW|CONTENTS_DEBRIS|CONTENTS_HITBOX*/
/*CONTENTS_SOLID|CONTENTS_GRATE|CONTENTS_HITBOX*/,NULL,&tr);
__CATCH;
// to draw
end._init<Vector>(tr.endpos);
// dont go past here if you not intend to do anything else than draw
if ( !val )
{
return false;
}
if( tr.m_pEnt == NULL )
{
return false;
}
int index = tr.m_pEnt->entindex()/*index*/;
if( index < 0 )
{
return false;
}
entity_info* pl = m_pEntList->get_entity(index);
if( pl == NULL )
{
return false;
}
// dont shoot at barrels , weapons, etc...
if( pl->is_a_player() == false )
{
return false;
}
// is our enemy?
// is allowed to die?
if( check(pl,true) == false )
{
return false;
}
// not needed
// if( tr.fraction < 0.92 )
// {
// return;
// }
// this will enable aimbot / no checks
if ( val == 1 )
{
// bugged model?
int m = pl->get_max_hitboxes();
if( m == -1 )
{
return false;
}
// auto aim at that guy
// in the middle of the hitbox we point at
best_player = pl;
used_bone_index = tr.hitbox;
}
// die now thanks
return true;
}
void aimbot::spinbot( CUserCmd*cmd )
{
if( cmd == NULL )
{
return;
}
if ( !m_pCvars->aim_spinbot->GetBool() )
{
return;
}
int rand_factor = -360;
switch ( rand() % 5 )
{
case 0: rand_factor = -359.5416; break;
case 1: rand_factor = 359.5416; break;
case 2: rand_factor = -179.8137; break;
case 3: rand_factor = 179.8137; break;
case 4: rand_factor = -89.8549; break;
case 5: rand_factor = 89.8549; break;
}
angles_3d new_angles(0,0,0);
switch ( m_pCvars->aim_spinbot->GetInt() )
{
case 1:
// spin + invert view
new_angles.x = -cmd->viewangles.x;
new_angles.y = fmod(GetTickCount() / 0.001f* 360.0f, 360.0f);
new_angles.z = rand_factor;
break;
case 2:
// up / down,spin + invert view
new_angles.x = fmod(GetTickCount() / 0.001f* 60.0f, 60.0f);
new_angles.y = -cmd->viewangles.y;
new_angles.z = rand_factor;
break;
case 3:
// spin all the way out + invert view
new_angles.x = fmod(GetTickCount() / 0.001f* 60.0f, 60.0f);
new_angles.y = fmod(GetTickCount() / 0.001f* 360.0f, 360.0f);
new_angles.z = rand_factor;
break;
case 4:
// total inversion
new_angles.x = -cmd->viewangles.x;
new_angles.y = -cmd->viewangles.y;
new_angles.z = rand_factor;
break;
case 5:
// total inversion 2
new_angles.x = cmd->viewangles.x + rand_factor;
new_angles.y = cmd->viewangles.y + rand_factor;
new_angles.z = rand_factor;
break;
case 6:
// you may like pancakes?
new_angles.x = cmd->viewangles.x - rand_factor;
new_angles.y = cmd->viewangles.y + rand_factor;
new_angles.z = rand_factor;
break;
}
// current move
float forward = cmd->forwardmove;
float right = cmd->sidemove;
float up = cmd->upmove;
// untouched viewangles
angles_3d viewangles(
cmd->viewangles.x,
cmd->viewangles.y,
cmd->viewangles.z);
vector_3d viewforward, viewright, viewup;
viewangles._angle_vectors(&viewforward, &viewright, &viewup);
// put our garbage instead of viewangles
cmd->viewangles = new_angles._Convert<QAngle>();
// garbage viewangles
viewangles._init(
cmd->viewangles.x,
cmd->viewangles.y,
cmd->viewangles.z);
//------------------------------------------//
// fix walking
vector_3d aimforward, aimright, aimup;
viewangles._angle_vectors(&aimforward, &aimright, &aimup);
vector_3d vForwardNorm, vRightNorm, vUpNorm;
extern void VectorNormalize_Spinbot(vector_3d&,vector_3d*);
VectorNormalize_Spinbot(viewforward, &vForwardNorm );
VectorNormalize_Spinbot(viewright , &vRightNorm );
VectorNormalize_Spinbot(viewup , &vUpNorm );
vector_3d
fw = vForwardNorm * vector_3d(forward,forward,forward),
ri = vRightNorm * vector_3d(right,right,right),
uu = vUpNorm * vector_3d(up,up,up);
// now we walk normally
cmd->forwardmove = fw._dot_product(aimforward) + ri._dot_product(aimforward) + uu._dot_product(aimforward);
cmd->sidemove = fw._dot_product(aimright) + ri._dot_product(aimright) + uu._dot_product(aimright);
cmd->upmove = fw._dot_product(aimup) + ri._dot_product(aimup) + uu._dot_product(aimup);
}
void aimbot::aiming_doit(CUserCmd* cmd)
{
if ( cmd == NULL )
{
return;
}
if( best_player == NULL )
{
return;
}
my_current_aim = get_aim_point( best_player );
if( my_current_aim._is_zero() )
{
return;
}
entity_info* me = m_pEntList->get_local();
if( me == NULL )
{
return;
}
if( !me->is_alive() )
{
return;
}
angles_3d meyes = me->GetEyesAngle();
if( meyes._is_zero() )
{
return;
}
//aim to kill
if ( aim_at_this(meyes,my_current_aim,cmd) )
{
// if triggerbot is 3 just fix inside aimbot,
// disable it for manual shot and triggerbot
int val = m_pCvars->aim_triggerbot->GetInt();
if ( val == 3 )
{
// fix angles
extern void fix_angles( CUserCmd* cmd );
fix_angles( cmd );
}
}
}
void aimbot::aiming_time(CUserCmd* cmd)
{
drop_current();
if( cmd != NULL )
{
// normal try
bool aimat = aim_trigger_bot(my_current_aim_draw);
if ( aimat )
{
// fire then,
add_flags(cmd->buttons,IN_ATTACK);
my_current_aim = my_current_aim_draw;
}
// will directly aim?
bool got = (best_player != NULL) ? true : false;
if ( got == false )
{
__TRY;
// or we will search a poor victim :p
got = search_best_player();
__CATCH;
}
// kill him already
if ( got == true )
{
__TRY;
aiming_doit(cmd);
__CATCH;
}
}
drop_current();
}
vector_3d aimbot::get_aim_point( entity_info* pl )
{
entity_info* me = m_pEntList->get_local();
if( pl == NULL || me == NULL )
{
return vector_3d(0,0,0);
}
vector_3d aimdot(0,0,0);
switch ( m_pCvars->aim_mode->GetInt() )
{
default:
case 0:
//BONE MODE
aimdot._vector_add(pl->bone_pos(used_bone_index));
break;
case 1:
//HITBOX MODE
aimdot._vector_add(pl->hitbox_pos(used_bone_index));
break;
case 2:
//VECTOR MODE
aimdot._vector_add(pl->GetAbsOrigin());
aimdot._vector_add(vector_3d(
m_pCvars->aim_vector_x->GetFloat(),
m_pCvars->aim_vector_y->GetFloat(),
m_pCvars->aim_vector_z->GetFloat()));
uint fl = pl->Getflags();
if ( fl )
{
if( !chk_flags(fl,FL_ONGROUND) )
{
aimdot._vector_add(vector_3d(0,0,25));
}
if( chk_flags(fl,FL_DUCKING) )
{
aimdot._vector_substract(vector_3d(0,0,25));
}
}
break;
}
if( m_pCvars->misc_aimbot_position_tweak->GetBool() )
{
aimdot._vector_add( vector_3d(
m_pCvars->misc_aimbot_position_tweak_x->GetFloat(),
m_pCvars->misc_aimbot_position_tweak_y->GetFloat(),
m_pCvars->misc_aimbot_position_tweak_z->GetFloat()));
}
if ( !aimdot._is_valid() || aimdot._is_zero() )
{
return vector_3d(0,0,0);
}
// only need it if it's moving & if no speedhack
if ( (pl->Getspeed() > 0 || me->Getspeed() > 0) )
{
INetChannelInfo* ntw = valve_games_interfaces::m_pEngine->GetNetChannelInfo();
if ( ntw )
{
// get latency
uint fLatency = ntw->GetLatency( FLOW_OUTGOING );
if ( fLatency > 5 && fLatency < 500 )
{
// apply predict
aimdot._vector_ma(aimdot,1 + fLatency);
}
else
{
if ( fLatency >= 499 )
{
// apply predict
aimdot._vector_ma(aimdot,1 + 500);
}
}
}
}
//aim to kill
return aimdot;
}
bool aimbot::aim_at_this(angles_3d& your_angles, vector_3d position, CUserCmd*cmd )
{
if( cmd == NULL )
{
return false;
}
if( !position._is_valid() || position._is_zero() )
{
return false;
}
entity_info* me = m_pEntList->get_local();
if ( me == NULL )
{
return false;
}
if ( me->is_alive() == false )
{
return false;
}
vector_3d aim = position;
vector_3d eyes = me->GetEyesPos();
Vector eye = eyes._Convert<Vector>();
QAngle old = cmd->viewangles;
// get aim angles
your_angles._calculate_angle(eyes,aim);
if( !your_angles._is_valid() || your_angles._is_zero() )
{
return false;
}
// slow aim is slow.
if( m_pCvars->misc_slow_aimbot_move->GetBool() )
{
angles_3d qDelta;
qDelta._init<QAngle>(your_angles._Convert<QAngle>() - cmd->viewangles);
while(qDelta.x > 180) qDelta.x -= 360;
while(qDelta.y > 180) qDelta.y -= 360;
while(qDelta.z > 180) qDelta.z -= 360;
while(qDelta.x < -180) qDelta.x += 360;
while(qDelta.y < -180) qDelta.y += 360;
while(qDelta.z < -180) qDelta.z += 360;
your_angles._init<QAngle>(
cmd->viewangles + qDelta._Convert<QAngle>() / m_pCvars->misc_slow_aimbot_move->GetFloat());
while(your_angles.x > 180) your_angles.x -= 360;
while(your_angles.y > 180) your_angles.y -= 360;
while(your_angles.z > 180) your_angles.z -= 360;
while(your_angles.x < -180) your_angles.x += 360;
while(your_angles.y < -180) your_angles.y += 360;
while(your_angles.z < -180) your_angles.z += 360;
}
// set aim angles
cmd->viewangles = your_angles._Convert<QAngle>();
// silent aim (set view yes/no)
if ( !m_pCvars->aim_silent->GetBool() )
{
QAngle bak = cmd->viewangles;
QAngle rec = bak - m_pNospread->qreco._Convert<QAngle>();
// remove visual recoil on aim , or not
if ( m_pCvars->aim_norecoil->GetInt() == 2 )
{
if( m_pCvars->misc_slow_aimbot_move->GetBool() )
{
// set aim angles
rec = bak;
}
else
{
// set aim angles , and remove punch angles
rec = bak - m_pNospread->qreco._Convert<QAngle>();
}
}
else
{
// set aim angles
rec = bak;
}
// traditional aim way
valve_games_interfaces::m_pEngine->SetViewAngles(rec);
//
// // and this too, but that's clearly not needed
// valve_games_interfaces::m_pPrediction->SetViewAngles(rec);
//
// // multiple things that are supposed to do the same action
// valve_games_interfaces::m_pRender->SetMainView(eye,rec);
//
// // we'll do that also
// valve_games_interfaces::m_pClient->SetCrosshairAngle(rec);
// one of them paint black over the screen(randomly on use),
// i let you find which one of them lulz
}
//////////////////////////////////////////////////////////////////////////
// Disconnect: Kicked by Console : [zBlock] Invalid Eye-Angles Detected.
C_BaseEntity* be = me->base_entity();
if ( be != NULL )
{
if ( hl2_offsets::m_iEyeAnglesX && hl2_offsets::m_iEyeAnglesY )
{
m_pExport->SetClass_float(be,hl2_offsets::m_iEyeAnglesX,old.x);
m_pExport->SetClass_float(be,hl2_offsets::m_iEyeAnglesY,old.y);
be->OnDataChanged( DATA_UPDATE_DATATABLE_CHANGED );
}
}
if ( !m_pCvars->aim_fire->GetBool() )
{
return true;
}
//ATTACK?
add_flags(cmd->buttons,IN_ATTACK);
return true;
}