Getting the bones CoD4 CoD5

From UnKnoWnCheaTs Game Hacking Wiki
Jump to: navigation, search

Posted by R4z8r.



Hey guys,

here's how to get and use the bones:


CHAR* BoneTags[21] = { "j_head", "j_helmet", "j_spineupper", "j_spinelower",
        "j_ankle_le", "j_ankle_ri", "j_hip_le", "j_hip_ri", "pelvis",
        "j_elbow_le", "j_elbow_ri", "j_knee_le", "j_knee_ri", "j_shoulder_le",
        "j_shoulder_ri" , "j_wrist_le", "j_wrist_ri",
        "j_clavicle_le", "j_clavicle_ri", "neck", "j_spine4" };


VOID CBot::GetBoneOrigin ( CEntity* Ent, FLOAT* Origin, WORD Bone )
{
    if(!GetEntityTag( Bone, Ent, Origin ) )
        Origin    = Ent->GetOrigin();
}

FLOAT* CBot::GetHeadOrigin ( CEntity* Ent )
{
    FLOAT* vOut = Ent->GetOrigin();

    if(!Ent->IsPlayer())
        return vOut;

    GetBoneOrigin( Ent, vOut, TagHead );

    return vOut;
}

FLOAT* CBot::GetHelmetOrigin ( CEntity* Ent )
{
    FLOAT* vOut = Ent->GetOrigin();

    if(!Ent->IsPlayer())
        return vOut;

    GetBoneOrigin( Ent, vOut, TagHelmet );

    return vOut;
}

FLOAT* CBot::GetSpineOrigin ( CEntity* Ent )
{
    FLOAT* vOut = Ent->GetOrigin();

    if(!Ent->IsPlayer())
        return vOut;

    GetBoneOrigin( Ent, vOut, TagSpine );

    return vOut;
}

FLOAT* CBot::GetNeckOrigin( CEntity* Ent )
{
    FLOAT* vOut = Ent->GetOrigin();

    if(!Ent->IsPlayer())
        return vOut;

    GetBoneOrigin( Ent, vOut, TagNeck );

    return vOut;
}

FLOAT* CBot::GetFeetOrigin( CEntity* Ent )
{
    FLOAT* Origin = Ent->GetOrigin();

    if(!Ent->IsPlayer())
        return vOut;

    return Origin;
}

And now use it like this:


WorldToScreen( GetHeadOrigin( Ent ), vOut );

DrawText( vout[0], vout[1], bla bla )

Or draw a bone esp


CHAR* Bone_Middle[5] =        { "j_head", "neck", "j_spineupper", "j_spinelower", "pelvis" };
CHAR* Bone_Right_Arm[5]  =    { "neck", "j_clavicle_ri", "j_shoulder_ri", "j_elbow_ri", "j_wrist_ri" };
CHAR* Bone_Left_Arm[5]  =    { "neck", "j_clavicle_le", "j_shoulder_le", "j_elbow_le", "j_wrist_le" };
CHAR* Bone_Right_Leg[5] =    { "pelvis", "j_knee_ri", "j_ankle_ri", "j_ankle_ri", "j_ankle_ri" };
CHAR* Bone_Left_Leg[5] =    { "pelvis", "j_knee_le", "j_ankle_le", "j_ankle_le", "j_ankle_le" };

VOID CBot::DrawBone( CEntity* Ent, CHAR* BoneName1, CHAR* BoneName2, DWORD dwColor )
{
    D3DXVECTOR2 vLine[2];
    Vec3 vBonePos1, vBonePos2;

    pLine->SetAntialias( FALSE );
    pLine->SetWidth( fBoneThickness );

    WorldToScreen( GetBoneOrigin( Ent, BoneName1 ), vBonePos1 );
    WorldToScreen( GetBoneOrigin( Ent, BoneName2 ), vBonePos2 );

    vLine[0].x = vBonePos1[0];
    vLine[0].y = vBonePos1[1];
    vLine[1].x = vBonePos2[0];
    vLine[1].y = vBonePos2[1];

    pLine->Begin();
    pLine->Draw( vLine, 2, dwColor );
    pLine->End();
}

VOID CBot::DrawBoneEsp( CEntity* Ent, DWORD dwCol )
{
    for( int i = 0; i < 4; i++ )
    {
        DrawBone( Ent, Bone_Middle   [i],    Bone_Middle   [i+1], dwCol );
        DrawBone( Ent, Bone_Right_Arm[i],    Bone_Right_Arm[i+1], dwCol );
        DrawBone( Ent, Bone_Left_Arm [i],    Bone_Left_Arm [i+1], dwCol );
        DrawBone( Ent, Bone_Right_Leg[i],    Bone_Right_Leg[i+1], dwCol );
        DrawBone( Ent, Bone_Left_Leg [i],    Bone_Left_Leg [i+1], dwCol );
    }
}

have fun,

R4z8r

Credits: Tamimego and Strife