
Originally Posted by
Eclipse
Aimbot FOV, Enjoy

- Please dont say how to use this, I will just ignore it.
Code:
int CrosshairX = (s_width / 2);
int CrosshairY = (s_height / 2);
float x = (bone.x - CrosshairX);
float y = (bone.y - CrosshairY);
float EnemyDistFromXhair = (float)sqrt((x * x) + (y * y));
global::aimdistance = local.Distance(pos) / 100.f;
float MaxFov = 120.f;
if (global::aimdistance < 15.f)
MaxFov = 180.f;
else
MaxFov = 120.f;
if (global::aimdistance < 8.f)
MaxFov = 220.f;
if (EnemyDistFromXhair >= 0.f && EnemyDistFromXhair <= MaxFov && global::aimdistance > 0.f && global::aimdistance < 200.f && global::aimhealth > 0.f)
{
global::temptarget = i;
}
What the hell is this crap? I joined to check out some pubg cheat code, and this is the sort of stuff posted? It looks like it was written by a beginner and offers nothing to anybody that could already code. So, since nobody else has called this out, i see
1) You doing some basic trig to get distance from xhair to player using the player's bone coord, but you don't say how your transforming 2d xhair position and 3d bone position to the same coordinate system, so, this part only benefits people who didnt pass grade 9 math and don't know Pythagoras theorem.
2) You've correlated a set of distances with a set of FOVs, but given no context to why (eg, you don't say what local.Distance(pos) is). Based on the fact you're using 15x, 8x, etc, i assume youre using it to detect current scope, which makes sense as you want the FOV. This code is stupid on many levels. On a basic technical level, try writing proper IF statements, eg, you have superfluous else clause, and then a totally separate IF rather than all one single, sensible conditional. On a DEEPER technical level, this entire thing should be an enum or associate array (eg std::map, whatever) if you're doing a lookup to hardcoded values. On a deeper conceptual level, this is super naive, surely there is a way to calculate FOV more accurately, eg, taking into account a) user FOV settings, b) different scopes not accounted for here, such as 1.5x zoom from red dot sights.
So basically, i just don't understand why this was even posted, it offers nothing to someone that can code, and it offers nothing to someone like me that CAN code, but hasn't previously hacked the game.
PS if there is honestly something useful here i've missed, my apologies, and please point it out.