unknowncheats uc-forum.com ucdownloads ucdownloads.com

Go Back   UC-Tutorials - Multiplayer Game Hacking and Cheat Tutorials > First-Person Shooters > Other FPS Games > Crysis

- Sponsored Advertisement -
http://www.myfpscheats.com/

Reply
 
Thread Tools Display Modes
  #1  
Old 02-23-2010, 07:43 PM
disco disco is offline
Super Moderator
 
Join Date: Feb 2010
Posts: 271
Default Creating a basic ESP

Posted by R4z8r.



This is probably nothing new, since okidoki ripped crysis apart already, but it wasnt posted here yet. If you don't got the Crysis sdk already, download it!

First we need to get the local entity/actor:

Code:
IActor* CBot::GetLocalPlayer()
{
    if(!System->GetIGame() )
        return 0;

    if(!System->GetIGame()->GetIGameFramework())
        return 0;

    return System->GetIGame()->GetIGameFramework()->GetClientActor();
}

IEntity* CBot::GetLocalEntity()
{
    IActor* Player = GetLocalPlayer();

    if(!Player)
        return 0;

    return Player->LinkedEntity;
}
Next we need to create an iterator, so we can loop through all the players + entities.

Code:
ActorIt = System->GetIGame()->GetIGameFramework()->GetIActorSystem()->CreateActorIterator();
IEntityIt* EntityIt = System->GetIEntitySystem()->GetEntityIterator();
We also need a WorldToScreen function( the one I am using is the one from the engine though ):

Code:
BOOL CBot::WorldToScreen(FLOAT* vEntPos, FLOAT* vOut)
{
    IRenderer* Renderer = System->GetIRenderer();

    Renderer->ProjectToScreen( vEntPos[0], vEntPos[1], vEntPos[2], &vOut[0], &vOut[1], &vOut[2] );

    vOut[0] *= ( Renderer->GetWidth()  / 100.0f );
    vOut[1] *= ( Renderer->GetHeight() / 100.0f );
    vOut[2] *= 1.0f;

    return ( (vOut[2] < 1.0f) );
}
We also want to use the bones, don't we?

Code:
Vec3 CBot::GetBoneOrigin( IEntity* Ent, CONST CHAR* szBoneName )
{
    if(!Ent->GetCharacter(0))
        return Vec3(0,0,0);

    ISkeletonPose* Skeleton = Ent->GetCharacter(0)->GetISkeletonPose();

    if(!Skeleton)
        return Vec3(0,0,0);

    uint16 BoneId = Skeleton->GetBoneIdByName( szBoneName );

    Vec3 vOffset = Skeleton->GetBoneById( BoneId )->vOffset;

    return (Ent->GetWorldPos() + vOffset);
}

Vec3 CBot::GetBoneOrigin( IEntity* Ent, uint16 BoneId )
{
    if(!Ent->GetCharacter(0))
        return Vec3(0,0,0);

    ISkeletonPose* Skeleton = Ent->GetCharacter(0)->GetISkeletonPose();

    if(!Skeleton)
        return Vec3(0,0,0);

    Vec3 vOffset = Skeleton->GetBoneById( BoneId )->vOffset;

    return (Ent->GetWorldPos() + vOffset);
}
Now we just need to loop through all players + entities:

Code:
for(; IActor* Player = ActorIt.get()->Next(); )
    {
        IEntity* Ent = Player->LinkedEntity;

        if( (!Player) || (Player == LocalPlayer) || (!Ent) )
            continue;

        if(!WorldToScreen( GetBoneOrigin( Ent, "Bip01 Neck" ), vOut ) )
            continue;

        if( (vOut[0] < 0) || (vOut[0] > pViewPort.Width) || (vOut[1] < 0) || (vOut[1] > pViewPort.Height) )
            continue;

if(pMenu.MySubMenu[ESP]->GetValueByName( "Name Esp" ) )
        {
            Draw.Text_Border( vOut[0] - 10.0f, vOut[1], dwColor, EspFont, "%s", Player->LinkedEntity->GetName() );
            vOut[1] += 13.0f;
        }
The bones that can be used:

Code:
CONST CHAR* BoneName[37] = {  
    "eye_left_bone",
    "eye_right_bone",
    "weapon_bone",
    "Bip01 Pelvis",
    "Bip01 Spine",
    "Bip01 L Thigh",
    "Bip01 R Thigh",
    "Bip01 Spine1",
    "Bip01 Spine2",
    "Bip01 Neck",
    "Bip01 Head",
    "Bip01 L Clavicle",
    "Bip01 R Clavicle",
    "Bip01 L UpperArm",
    "Bip01 L Forearm",
    "Bip01 L Hand",
    "Bip01 L Finger0",
    "Bip01 L Finger1",
    "Bip01 L Finger2",
    "Bip01 L Finger01",
    "Bip01 L Finger11",
    "Bip01 L Finger21",
    "Bip01 R UpperArm",
    "Bip01 R Forearm",
    "Bip01 R Hand",
    "Bip01 R Finger0",
    "Bip01 R Finger1",
    "Bip01 R Finger2",
    "Bip01 R Finger01",
    "Bip01 R Finger11",
    "Bip01 R Finger21",
    "Bip01 L Calf",
    "Bip01 L Foot",
    "Bip01 L Toe0",
    "Bip01 R Calf",
    "Bip01 R Foot",
    "Bip01 R Toe0",
};
Well, that's all I guess. Credits all go to okidoki, he did all the major work.

Have fun hacking,

R4z8r
Reply With Quote
Reply

  • Submit Thread to Digg
  • Submit Thread to del.icio.us
  • Submit Thread to StumbleUpon
  • Submit Thread to Google
  • Submit Thread to Facebook
  • Submit Thread to My Yahoo!
  • Submit Thread to MySpace
  • Submit Thread to Twitter
  • Submit Thread to Reddit

Tags
basic, creating, esp

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 06:43 PM.


- Sponsored Advertisement -
http://www.myfpscheats.com/