Project Learning C++

Posts 1–6 of 6 · Page 1 of 1
Project Learning C++
Hey, i started learning C++ by trying editing sources..
I did find one interesting source that i dont really understand.. Could anyone explain what this does?

Code:
bool EdgeAntiAim( cEntity *localPlayer, CUserCmd *cmd, float flWall, float flCornor )
{
    static CTraceFilterNoPlayers filter;
 
    bool ret = false;
 
    Vector localPosition = localPlayer->GetEyePosition( );
 
    for( int y = 0; y < 360; y++ )
    {
        Vector tmp( 10.0f, cmd->viewangles.y, 0.0f );
        tmp.y += y;
        tmp.NormalizeAngles( );
 
        Vector forward;
        AngleVectors( tmp, forward );
 
        float length = ( ( 16.0f + 3.0f ) + ( ( 16.0f + 3.0f ) * sin( DegToRad( 10.0f ) ) ) ) + 7.0f;
        forward *= length;
 
        Ray_t ray;
        trace_t traceData;    
 
        ray.Init( localPosition, ( localPosition + forward ) );
        g_pEngineTrace->TraceRay( ray, 0x200400B, ( CTraceFilter* )&filter, &traceData );
 
        if( traceData.fraction != 1.0f )
        {
            Vector angles;
            Vector Negate = traceData.plane.normal;
 
            Negate *= -1;
            VectorAngles( Negate, angles );
 
            tmp.y = angles.y;
            tmp.NormalizeAngles( );
            trace_t leftTrace, rightTrace;
 
            Vector left, right;
            AngleVectors( tmp + Vector( 0.0f, 30.0f, 0.0f ), left );
            AngleVectors( tmp - Vector( 0.0f, 30.0f, 0.0f ), right );
 
            left *= ( length + ( length * sin( DegToRad( 30.0f ) ) ) );
            right *= ( length + ( length * sin( DegToRad( 30.0f ) ) ) );
 
            ray.Init( localPosition, ( localPosition + left ) );
            g_pEngineTrace->TraceRay( ray, 0x200400B, ( CTraceFilter* )&filter, &leftTrace );
 
            ray.Init( localPosition, ( localPosition + right ) );
            g_pEngineTrace->TraceRay( ray, 0x200400B, ( CTraceFilter* )&filter, &rightTrace );
 
            if ( ( leftTrace.fraction == 1.0f )
                && ( rightTrace.fraction != 1.0f ) )
            {
                tmp.y -= flCornor;
                // LEFT
            }
            else if ( ( leftTrace.fraction != 1.0f )
                && ( rightTrace.fraction == 1.0f ) )
            {
                tmp.y += flCornor;
                // RIGHT
            }
 
            cmd->viewangles.y = tmp.y;
            cmd->viewangles.y -= flWall;
            ret = true;
        }
    }
 
    return ret;
}
It's a snippet for anti aim.
this is the edge type of anti aim, mainly used in hack-vs-hack servers and it fakes your hitbox to other players
And you can't do shit with only that snippet, I am not an internal expert but it looks like spinbot.
Oh alright... I thought myself its Full anti-aim code start i could start editing and testing..
Damm cant find working source to edit.

But yeah thanks for all who commented
Mää noobina kokeilin jopa compiloida tota sourcea suoraan
Posts 1–6 of 6 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us