This all requires the OGC aimbot for the findtarget and the other functions it calls so it can
autoaim. But you must clear the vectors by doing avclear before doing anything else.
Ok, here it is... the secret.
VIEW_OFS AIMING
Put this in HUD_Playermove below this:
me.ent = gEngfuncs.GetLocalPlayer();
me.pmFlags = a->flags; cl_entity_s* ent = vPlayers[gAimbot.target].getEnt();
me.pmMoveType = a->movetype;
VectorCopy(a->velocity,me.pmVelocity);
Code:
///////////////////////////////////////////////////////////////////////////
//BEGIN PL4Y3R-X AIMBOT///////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
///////////////////////////
//////Makes it Happen/////
/////////////////////////
gEngfuncs.pEventAPI->EV_LocalPlayerViewheight(me.pmEyePos); //eyepos or known as view_ofs
///////////////////////
if(cvar.pxaim==1)
{
vec3_t forward,right,up, playerAngles;
playerAngles[0]=0;
playerAngles[1]=vPlayers[gAimbot.target].getEnt()->angles[1];
playerAngles[2]=0;
gEngfuncs.pfnAngleVectors (playerAngles, forward, right, up);
forward[2] = -forward[2];
me.pmEyePos[0] = (forward[0]*-cvar.y)+(right[0]*-cvar.x)+(up[0]*-cvar.u);
me.pmEyePos[1] = (forward[1]*-cvar.y)+(right[1]*-cvar.x)+(up[1]*-cvar.u);
me.pmEyePos[2] += (forward[2]*-cvar.y)+(right[2]*-cvar.x)+(up[2]*-cvar.u);
VectorAngles(me.pmEyePos,gAimbot.aim_viewangles);
if (gAimbot.aim_viewangles[0]>180) gAimbot.aim_viewangles[0]-=360;
if (gAimbot.aim_viewangles[1]>180) gAimbot.aim_viewangles[1]-=360;
}
//////////////////////
////DUCK/////////////
////////////////////
if(cvar.pxaim!=0 && vPlayers[gAimbot.target].getEnt()->curstate.usehull==1)
{
vec3_t forward,right,up, playerAngles;
playerAngles[0]=0;
playerAngles[1]=vPlayers[gAimbot.target].getEnt()->angles[1];
playerAngles[2]=0;
gEngfuncs.pfnAngleVectors (playerAngles, forward, right, up);
forward[2] = -forward[2];
me.pmEyePos[0] = (forward[0]*-cvar.dy)+(right[0]*-cvar.dx)+(up[0]*-cvar.d);
me.pmEyePos[1] = (forward[1]*-cvar.dy)+(right[1]*-cvar.dx)+(up[1]*-cvar.d);
me.pmEyePos[2] += (forward[2]*-cvar.dy)+(right[2]*-cvar.dx)+(up[2]*-cvar.d);
VectorAngles(me.pmEyePos,gAimbot.aim_viewangles);
if (gAimbot.aim_viewangles[0]>180) gAimbot.aim_viewangles[0]-=360;
if (gAimbot.aim_viewangles[1]>180) gAimbot.aim_viewangles[1]-=360;
}
/////////////////////////////////////
/////RUN////////////////////////////
///////////////////////////////////
if(cvar.pxaim!=0 && vPlayers[gAimbot.target].getEnt()->curstate.gaitsequence==4)
{
vec3_t forward,right,up, playerAngles;
playerAngles[0]=0;
playerAngles[1]=vPlayers[gAimbot.target].getEnt()->angles[1];
playerAngles[2]=0;
gEngfuncs.pfnAngleVectors (playerAngles, forward, right, up);
forward[2] = -forward[2];
me.pmEyePos[0] = (forward[0]*-cvar.f)+(right[0]*-cvar.r)+(up[0]*-cvar.j);
me.pmEyePos[1] = (forward[1]*-cvar.f)+(right[1]*-cvar.r)+(up[1]*-cvar.j);
me.pmEyePos[2] += (forward[2]*-cvar.f)+(right[2]*-cvar.r)+(up[2]*-cvar.j);
VectorAngles(me.pmEyePos,gAimbot.aim_viewangles);
if (gAimbot.aim_viewangles[0]>180) gAimbot.aim_viewangles[0]-=360;
if (gAimbot.aim_viewangles[1]>180) gAimbot.aim_viewangles[1]-=360;
}
////////////////////////////////////
///////JUMP////////////////////////
//////////////////////////////////
pmtrace_s* tr;
vec3_t jesus, vorigin;
int CurH = vPlayers[gAimbot.target].getEnt()->current_position;
int PrevH = ((CurH - 1) + HISTORY_MAX) % HISTORY_MAX;
jesus = vPlayers[gAimbot.target].getEnt()->ph[CurH].origin;
vorigin[0] = jesus[0] + (jesus[0] - vPlayers[gAimbot.target].getEnt()->ph[PrevH].origin[0]);
vorigin[1] = jesus[1] + (jesus[1] - vPlayers[gAimbot.target].getEnt()->ph[PrevH].origin[1]);
vorigin[2] = jesus[2] + (jesus[2] - vPlayers[gAimbot.target].getEnt()->ph[PrevH].origin[2])-cvar.length;
tr=gEngfuncs.PM_TraceLine( jesus, vorigin, PM_TRACELINE_PHYSENTSONLY, 2, vPlayers[gAimbot.target].getEnt()->index);
if(cvar.pxaim!=0 && (tr->endpos[2]-jesus[2]>cvar.sp) ||cvar.pxaim!=0 && vPlayers[gAimbot.target].getEnt()->curstate.gaitsequence==6)
{
vec3_t forward,right,up, playerAngles;
playerAngles[0]=0;
playerAngles[1]=vPlayers[gAimbot.target].getEnt()->angles[1];
playerAngles[2]=0;
gEngfuncs.pfnAngleVectors (playerAngles, forward, right, up);
forward[2] = -forward[2];
me.pmEyePos[0] = (forward[0]*-cvar.my)+(right[0]*-cvar.mx)+(up[0]*-cvar.m);
me.pmEyePos[1] = (forward[1]*-cvar.my)+(right[1]*-cvar.mx)+(up[1]*-cvar.m);
me.pmEyePos[2] += (forward[2]*-cvar.my)+(right[2]*-cvar.mx)+(up[2]*-cvar.m);
VectorAngles(me.pmEyePos,gAimbot.aim_viewangles);
if (gAimbot.aim_viewangles[0]>180) gAimbot.aim_viewangles[0]-=360;
if (gAimbot.aim_viewangles[1]>180) gAimbot.aim_viewangles[1]-=360;
}
////////////////////////////////////////////////////////////////////
/////////////////////////END PL4Y3R-X AIMBOT///////////////////////
//////////////////////////////////////////////////////////////////
An experienced coder might wonder how this is fast compared to ogc since it is
another vector aimbot. But the gEngfuncs.pEventAPI->EV_LocalPlayerViewheight(me.pmEyePos); in
hud_playermove allows this to work and be faster by avoiding as many calculations.
In aimbot.cpp add this:
bool PathFrees(float* from,float* to)
{
//////////////////////////////////////////
//////////PX AUTOAIM-AUTOWALL////////////
////////////////////////////////////////
if (cvar.pxaim==1)
{
int pathtest;
pmtrace_t tr;
float Origin[3];
if ((currentWeaponID == WEAPON_MP5) ||(currentWeaponID == WEAPON_MAC)||(currentWeaponID == WEAPON_KNIFE)||(currentWeaponID == WEAPON_M3) ||(currentWeaponID == WEAPON_XM) ||(currentWeaponID == WEAPON_P90) ||(currentWeaponID == WEAPON_FIVE7) ||(currentWeaponID == WEAPON_UMP) || (currentWeaponID == WEAPON_ELITE) ||(currentWeaponID == WEAPON_TMP) || (currentWeaponID == WEAPON_GLOCK)|| (currentWeaponID == WEAPON_USP) || (currentWeaponID == WEAPON_P228) )
{gEngfuncs.pEventAPI->EV_SetTraceHull( 2 );
gEngfuncs.pEventAPI->EV_PlayerTrace( from, to, PM_GLASS_IGNORE, me.ent->index, &tr );
return ( tr.fraction == 1.0 ); }else
gEngfuncs.PM_TraceLine( Origin, me.pmEyePos, PM_WORLD_ONLY , 2, -1);
pathtest = (tr.fraction == 1.0);
if (!pathtest && cvar.autowall && CorrectGunX())
{
pathtest = CanPenetrate(from, to, CorrectGunX());
}
return pathtest;
}
////////////////////////////////////////////////////
/////////////END PX AUTOAIM-AUTOWALL///////////////
//////////////////////////////////////////////////
}
and in calcfovangleandvisibility,
PlayerInfo& r = vPlayers[ax];
r.fovangle = (float)((1.0-GetAimingFov(ax))*360.0);
Put this underneath that:
///////////////////////////////////////////////////
////////////////PX AUTOAIM-AUTOWALL///////////////
/////////////////////////////////////////////////
if (cvar.pxaim==1)
{
if(0) {}
if(!GetAimingTeam(ax))
{
r.visible = true;
}
if(r.fovangle>=0)
{
r.visible = PathFrees(vPlayers[ax].getEnt()->origin, me.pmEyePos);
}
if (target==-1)
{
r.visible = PathFrees(vPlayers[ax].getEnt()->origin, me.pmEyePos);
}
else if (target!=-1)
{
r.visible = PathFrees(vPlayers[ax].getEnt()->origin, me.pmEyePos);
}
}
////////////////////////////////////////////
///////////END PX AUTOAIM-AUTOWALL/////////
//////////////////////////////////////////
and in aimbot.h below int CanPenetrate( float *start, float *end, int power );
add this:
bool PathFrees( float *from, float *to );
And....
To make your own PX aim spots, these are the cvars:
u (for standing still height) 20-24. I use 22
y (for standing still forward) 6-8.5
x (for standing still right/left) 0-2
d (for duck height) 2-5
dy (for duck forward) 4-6
dx (for duck left/right) 1-2.5
j (for running height) depends. I use 0.
f (for running forward) 7-13
r (for running right/left) 0-1.7
m (for jumping height) -6 to -10
my (for jumping forward) 8-13
mx (for jumping right/left) 0-2
These are similar to ogc vectors. The difference is
the values are more sensitive. For jumping, the numbers should be negative
since it subtracts the height. The duck height is small because it adds
to the player's stand height.
To set the jump detection, do length -1 and sp 2. That's it. Then set the mx,my and m.
That's it. Credit PL4Y3R-X, amir for finding the use of gaitsequence which is used for different
animation sequence checks to detect a player's motion, Tabris (for the idea of using traceline to detect jumpers)
and I guess OGC for their findtarget function, but it is possible
to NOT use them and use this but requires making more code.