for reference, this is probably the most copy pasted clamping function, pretty sure it was written by Yamiez and it works perfectly, if your code is perfect, but you can get untrusted easily if your hack does dumb shit, which is usually connected with copy pasting
Code:
void AngleNormalize(float* angle)
{
if (angle[0] > 89.0f && angle[0] <= 180.0f)
{
angle[0] = 89.0f;
}
if (angle[0] > 180.f)
{
angle[0] -= 360.f;
}
if (angle[0] < -89.0f)
{
angle[0] = -89.0f;
}
if (angle[1] > 180.f)
{
angle[1] -= 360.f;
}
if (angle[1] < -180.f)
{
angle[1] += 360.f;
}
if (angle[2] != 0.0f)
{
angle[2] = 0.0f;
}
}
same with vectors etc....
gonna show some situations when this will cause untrusted:
1) angle[1] = 760.f
if (760 > 180.f)
{
angle[1] -= 360.f;
that is 400.f --> untrusted
}
fix:
while (angle[1] > 180.f)
{
angle[1] -= 360.f;
}
2) angle[0],angle[1] = 1.QNaN, infinite, other shit that is not number, usually connected with not having signonstate/lifestate/ingame check
fix: if(!std::isfinite(angle[0/1])) {
std::cout << "This shouldn't happen, logging value 0/1: " << angle[0/1] << "backwards slash n ...";
angle[0/1] = 0.f
}