Solved ESP Probelm

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

Rake

Cesspool Admin
Administrator
Jan 21, 2014
12,074
78,998
2,371
Ok I checked your code it is identical to the code that vikingtiger911 posted so you didn't make any mistakes copy and pasting the code. You updated the offsets and process information for your game. The game uses directx which is the same as the game viking tiger made so essentially the WorldToScreen math should be identical. It does appear that the WorldToScreen code works properly but your input arguments are potentially wrong. If you can make a bot match, freeze them with a console command if possible. Then stand right in front of them and look at them, and THEN turn on the ESP. Then make a video of your ESP as you move your crosshair around so I can understand what the problem is better. In your video there are too many variables changing because of your erratic movement. Just stand in one place so we can see what's happening, we need a control environment.

In your code there is a line:
C++:
    if (w < 0.01f)
        return false;
This line will check if the player it outside of clipspace(off the screen) and if so it won't draw the ESP, but your hack is drawing them when they are not in clip space which tells me there is definately a problem, either with your ViewMatrix or the vector you're reading as the enemy coordinates.

How did you find your ViewMatrix address?
 

mambda

headass
Escobar Tier VIP
Trump Tier Donator
Jun 25, 2014
2,295
37,938
269
Error on line 283, file #2, you forgot to carry the one.
 

Lovelace

Jr.Coder
Full Member
Nobleman
Oct 23, 2015
83
938
5
^ He's being sarcastic, ain't too obvious.

GDI? Probably. DirectX is better. If not, it would be better if you could provide a source code so we could point out the problem.
 

Rake

Cesspool Admin
Administrator
Jan 21, 2014
12,074
78,998
2,371
We can't help you if you do not provide enough details.
 

Camaru

Newbie
Oct 26, 2015
26
183
1
C++:
CHackProcess fProcess;
using namespace std;
#define F6_Key 0x75
#define RIGHT_MOUSE 0x02
int NumOfPlayers = 16;

const DWORD LocalPlayer = 0x11362B94 ;
const DWORD dw_mTeamOffset = 0x81;//client
const DWORD dw_Health = 0x4D0;//client
const DWORD dw_Pos = 0x550;//client
const DWORD EntityList = 0x11852391 ;
const DWORD EntityLoopDistance = 0x04;

const DWORD dw_vMatrix = 0x5E6C; // new 
RECT m_Rect;
 
HDC HDC_Desktop;

HBRUSH EnemyBrush;
HFONT Font; //font we use to write text with

HWND TargetWnd;
HWND Handle;
DWORD DwProcId;
 
COLORREF SnapLineCOLOR;
COLORREF TextCOLOR;
 
typedef struct
{
    float flMatrix[4][4];
}WorldToScreenMatrix_t;
 
float Get3dDistance(float * myCoords, float * enemyCoords)
{
    return sqrt(
        pow(double(enemyCoords[0] - myCoords[0]), 2.0) +
        pow(double(enemyCoords[1] - myCoords[1]), 2.0) +
        pow(double(enemyCoords[2] - myCoords[2]), 2.0));
 
}
 
 
void SetupDrawing(HDC hDesktop, HWND handle)
{
    HDC_Desktop = hDesktop;
    Handle = handle;
    EnemyBrush = CreateSolidBrush(RGB(255, 0, 0));
    //Color
    SnapLineCOLOR = RGB(0, 0, 255);
    TextCOLOR = RGB(0, 255, 0);
}
 
//We will use this struct throughout all other tutorials adding more variables every time
struct MyPlayer_t
{
    DWORD CLocalPlayer;
    int Team;
    int Health;
    WorldToScreenMatrix_t WorldToScreenMatrix;
    float Position[3];
    int flickerCheck;
    void ReadInformation()
    {
        // Reading CLocalPlayer Pointer to our "CLocalPlayer" DWORD.
        ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + LocalPlayer), &CLocalPlayer, sizeof(DWORD), 0);
        // Reading out our Team to our "Team" Varible.
        ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(CLocalPlayer + dw_mTeamOffset), &Team, sizeof(int), 0);
        // Reading out our Health to our "Health" Varible.    
        ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(CLocalPlayer + dw_Health), &Health, sizeof(int), 0);
        // Reading out our Position to our "Position" Varible.
        ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(CLocalPlayer + dw_Pos), &Position, sizeof(float[3]), 0);
 
        //Here we find how many player entities exist in our game, through this we make sure to only loop the amount of times we need
        //when grabbing player data
        //Note that this call could be even better at a regular 15 or so seconds timer but performance shouldn't vary a great deal
        //ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordEngine + dw_PlayerCountOffs), &NumOfPlayers, sizeof(int), 0);
 
 
 
        //anti flicker
        //VMATRIX
         
            ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + dw_vMatrix), &WorldToScreenMatrix, sizeof(WorldToScreenMatrix), 0);
         
        //-1A4 = ANTI FLICKER
        //Engine.dll+0x58C45C
    }
}MyPlayer;
 
//ENemy struct
struct PlayerList_t
{
    DWORD CBaseEntity;
    int Team;
    int Health;
    float Position[3];
    float AimbotAngle[3];
    char Name[39];
 
    void ReadInformation(int Player)
    {
        
        ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + EntityList + (Player * EntityLoopDistance)), &CBaseEntity, sizeof(DWORD), 0);
        
        ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(CBaseEntity + dw_mTeamOffset), &Team, sizeof(int), 0);
            
        ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(CBaseEntity + dw_Health), &Health, sizeof(int), 0);
        
        ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(CBaseEntity + dw_Pos), &Position, sizeof(float[3]), 0);
    }
}PlayerList[32];
 
 
bool WorldToScreen(float * from, float * to)
{
    float w = 0.0f;
 
    to[0] = MyPlayer.WorldToScreenMatrix.flMatrix[0][0] * from[0] + MyPlayer.WorldToScreenMatrix.flMatrix[0][1] * from[1] + MyPlayer.WorldToScreenMatrix.flMatrix[0][2] * from[2] + MyPlayer.WorldToScreenMatrix.flMatrix[0][3];
    to[1] = MyPlayer.WorldToScreenMatrix.flMatrix[1][0] * from[0] + MyPlayer.WorldToScreenMatrix.flMatrix[1][1] * from[1] + MyPlayer.WorldToScreenMatrix.flMatrix[1][2] * from[2] + MyPlayer.WorldToScreenMatrix.flMatrix[1][3];
    w = MyPlayer.WorldToScreenMatrix.flMatrix[3][0] * from[0] + MyPlayer.WorldToScreenMatrix.flMatrix[3][1] * from[1] + MyPlayer.WorldToScreenMatrix.flMatrix[3][2] * from[2] + MyPlayer.WorldToScreenMatrix.flMatrix[3][3];
 
    if (w < 0.01f)
        return false;
 
    float invw = 1.0f / w;
    to[0] *= invw;
    to[1] *= invw;
 
    int width = (int)(m_Rect.right - m_Rect.left);
    int height = (int)(m_Rect.bottom - m_Rect.top);
 
    float x = width / 2;
    float y = height / 2;
 
    x += 0.5 * to[0] * width + 0.5;
    y -= 0.5 * to[1] * height + 0.5;
 
    to[0] = x + m_Rect.left;
    to[1] = y + m_Rect.top;
 
    return true;
}
 

 
//We receive the 2-D Coordinates the colour and the device we want to use to draw those colours with
//HDC so we know where to draw and brush because we need it to draw
void DrawFilledRect(int x, int y, int w, int h)
{
    //We create our rectangle to draw on screen
    RECT rect = { x, y, x + w, y + h };
    //We clear that portion of the screen and display our rectangle
    FillRect(HDC_Desktop, &rect, EnemyBrush);
}
 
void DrawBoxer(int x, int y, int w, int h, char* string) {
    DrawBoxer(x, y, w, h, string);
}
 
 
 
 
 
void DrawBorderBox(int x, int y, int w, int h, int thickness)
{
    //Top horiz line
    DrawFilledRect(x, y, w, thickness);
    //Left vertical line
    DrawFilledRect(x, y, thickness, h);
    //right vertical line
    DrawFilledRect((x + w), y, thickness, h);
    //bottom horiz line
    DrawFilledRect(x, y + h, w + thickness, thickness);
}
 
 
//Here is where we draw our line from point A to Point B
void DrawLine(float StartX, float StartY, float EndX, float EndY, COLORREF Pen)
{
    int a, b = 0;
    HPEN hOPen;
    // penstyle, width, color
    HPEN hNPen = CreatePen(PS_SOLID, 2, Pen);
    hOPen = (HPEN)SelectObject(HDC_Desktop, hNPen);
    // starting point of line
    MoveToEx(HDC_Desktop, StartX, StartY, NULL);
    // ending point of line
    a = LineTo(HDC_Desktop, EndX, EndY);
    DeleteObject(SelectObject(HDC_Desktop, hOPen));
}
 
 
//Draw our text with this function
void DrawString(int x, int y, COLORREF color, const char* text)
{
    SetTextAlign(HDC_Desktop, TA_CENTER | TA_NOUPDATECP);
 
    SetBkColor(HDC_Desktop, RGB(0, 0, 0));
    SetBkMode(HDC_Desktop, TRANSPARENT);
 
    SetTextColor(HDC_Desktop, color);
 
    SelectObject(HDC_Desktop, Font);
 
    TextOutA(HDC_Desktop, x, y, text, strlen(text));
 
    DeleteObject(Font);
}
 
 
void DrawESP(int x, int y, float distance)
{
    //ESP RECTANGLE
    int width = 18100 / distance;
    int height = 37500 / distance;
    DrawBorderBox(x - (width / 2), y - height, width, height, 1);
 
    //Sandwich ++
    DrawLine((m_Rect.right - m_Rect.left) / 2,
        m_Rect.bottom - m_Rect.top, x, y,
        SnapLineCOLOR);
 
 
    std::stringstream ss;
    ss << (int)distance;
 
    char * distanceInfo = new char[ss.str().size() + 1];
    strcpy(distanceInfo, ss.str().c_str());
 
    DrawString(x, y, TextCOLOR, distanceInfo);
 
    delete[] distanceInfo;
}
 
void ESP()
{
    GetWindowRect(FindWindowA(NULL, "Counter-Strike: Global Offensive"), &m_Rect);
 
    for (int i = 0; i < NumOfPlayers; i++)
    {
        PlayerList[i].ReadInformation(i);
 
        if (PlayerList[i].Health < 2)
            continue;
 
        if (PlayerList[i].Team == MyPlayer.Team)
            continue;
 
 
        if (PlayerList[i].Team == MyPlayer.Team)
            continue;
        float EnemyXY[3];
        if (WorldToScreen(PlayerList[i].Position, EnemyXY))
        {
            DrawESP(EnemyXY[0] - m_Rect.left, EnemyXY[1] - m_Rect.top, Get3dDistance(MyPlayer.Position, PlayerList[i].Position));
        }
 
    }
}

Original from https://guidedhacking.com/showthread.php?6977-Fleep-Hack-CS-GO-Source-Code-ESP-Solved

here new problem

https://www.youtube.com/watch?v=oyPfNDOFtBg

//edited post to add correct CPP code tags. - Rake
 
Last edited:

mambda

headass
Escobar Tier VIP
Trump Tier Donator
Jun 25, 2014
2,295
37,938
269
For your new problem: Either the wrong viewmatrix or incorrect W2S code ( im too lazy to read it all, heheh. )
 

mambda

headass
Escobar Tier VIP
Trump Tier Donator
Jun 25, 2014
2,295
37,938
269
If its opengl then i cant help you, never worked with it.

DirectX you can hook certain functions that the viewmatrix could pass through, either shader related functions or shader buffer related functions. But i don't think that's the best answer for you atm. Can't really give you a specific answer as ive never worked on the game. Try looking through the w2s. maybe flip your indices.
 

Rake

Cesspool Admin
Administrator
Jan 21, 2014
12,074
78,998
2,371
jesus christ did you have to use a sniper rifle scope to make it even more confusing?
 

Rake

Cesspool Admin
Administrator
Jan 21, 2014
12,074
78,998
2,371
Yeah make sure you send it to my trash folder.
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods