Solved Problem with esp boxes (GDI&Directx)

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

cskimmo69

Newbie
Full Member
Nobleman
Jul 7, 2013
36
318
0
Hello i got problem with Grab's overlay for css and i need some help with it!

I can draw boxes of enemis only if i define the boxes X and Y like in that source they are.. X = 222 and Y = 222 but they are not on enemies they are at left up corner of css window.. How to fix this and get boxes to enemies?

Pic of the problem https://postimg.org/image/rfek9lqwr/

I think problem is in hDirectX.cpp
[C++] hDirectX.cpp - Pastebin.com


Everything is ok with fleep's GDI source but not with grab's dx.. =(
 
Last edited by a moderator:

c5

Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
Jul 19, 2012
1,187
19,938
76
What do you guys mean i should log? ok i log but what ? values like vmatrix or ? im tried to solve this now 2hours... tried to look if getting resolution was wrong but its ok, and distance its ok too and wts should be ok its like in gdi one but i dont know how it afffects in directx or does it matter sorry for my shitty english.
Wow 2 hours. Mate in all fairness, if you want something to be done, LEARN. Don't just copy and paste and expect it to work.. If those 2 hours is the limit of your patience - give up now; some of us here spend days debugging their code..

Learn:
https://guidedhacking.com/starthere
 
Last edited by a moderator:

TastyHorror

Coder
Dank Tier Donator
Nobleman
Oct 11, 2012
179
2,268
8
Haven't done dx9 esp yet but I suggest you debug your code at the world to screen function, or you can perhaps create many print statements displaying what certain things are, should be, and what they are at. I am sure it is a simple mistake.
 

cskimmo69

Newbie
Full Member
Nobleman
Jul 7, 2013
36
318
0
Printing wont help in this case.. Offsets and netvars are ok, world to screen should be ok, drawing is ok but happens only when i define boxes X and Y positions.. How could i solve this problem?
 

c5

Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
Jul 19, 2012
1,187
19,938
76
Looks like world to screen issue judging just by the picture, shouldn't make such errors just by drawing anyways.

Verify your w2s, probably a problem there
 

cskimmo69

Newbie
Full Member
Nobleman
Jul 7, 2013
36
318
0
Looks like world to screen issue judging just by the picture, shouldn't make such errors just by drawing anyways.

Verify your w2s, probably a problem there
I dont see any problem with wts it should work but... :l

C++:
#include "hDirectX.h"
#include "HackProcess.h"
 
IDirect3D9Ex* p_Object = 0;
IDirect3DDevice9Ex* p_Device = 0;
D3DPRESENT_PARAMETERS p_Params;
 
ID3DXLine* p_Line;
ID3DXFont* pFontSmall = 0;
 
CHackProcess fProcess;
 

int NumOfPlayers = 32;


const DWORD Player_Base = 0x55DB34;
const DWORD dw_mTeamOffset = 0x98;
const DWORD dw_Health = 0x90;
const DWORD dw_Pos = 0x25C;
const DWORD EntityPlayer_Base = 0x56B3E4;
const DWORD EntityLoopDistance = 0x10;
const DWORD dw_Dormant = 0x17A;
const DWORD dw_Lifestate = 0x8F;
const DWORD dw_vMatrix = 0x5A5730;
 



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));
}



struct MyPlayer_t  
{
        DWORD CLocalPlayer;
        int Team;
        int Health;
        WorldToScreenMatrix_t WorldToScreenMatrix;
        float Position[3];
        void ReadInformation()
        {
                // Reading CLocalPlayer Pointer to our "CLocalPlayer" DWORD.
                ReadProcessMemory (fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + Player_Base), &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);
 
                ReadProcessMemory (fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordEngine + dw_vMatrix), &WorldToScreenMatrix, sizeof(WorldToScreenMatrix), 0);
        }
}MyPlayer;
 
 

struct PlayerList_t
{
        DWORD CBaseEntity;
        int Team;
        int Health;
        int Alive;
        int Dormant;
        float Position[3];
        char Name[39];
 
        void ReadInformation(int Player)
        {
                // Reading CBaseEntity Pointer to our "CBaseEntity" DWORD + Current Player in the loop. 0x10 is the CBaseEntity List Size
                //"client.dll"+00545204 //0x571A5204
                ReadProcessMemory (fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + EntityPlayer_Base  + (Player * EntityLoopDistance)),&CBaseEntity, sizeof(DWORD), 0);
                // Reading out our Team to our "Team" Varible.
                ReadProcessMemory (fProcess.__HandleProcess, (PBYTE*)(CBaseEntity + dw_mTeamOffset), &Team, sizeof(int), 0);
                // Reading out our Health to our "Health" Varible.    
                ReadProcessMemory (fProcess.__HandleProcess, (PBYTE*)(CBaseEntity + dw_Health), &Health, sizeof(int), 0);
                // Reading out our Position to our "Position" Varible.
                ReadProcessMemory (fProcess.__HandleProcess, (PBYTE*)(CBaseEntity + dw_Pos), &Position, sizeof(float[3]), 0);
 
                //Alive
                ReadProcessMemory (fProcess.__HandleProcess, (PBYTE*)(CBaseEntity + dw_Lifestate), &Alive, sizeof(int), 0);
 
                //Dormant
                ReadProcessMemory (fProcess.__HandleProcess, (PBYTE*)(CBaseEntity + dw_Dormant), &Dormant, sizeof(int), 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;
}
 


int DirectXInit(HWND hWnd)
{
 
        if(FAILED(Direct3DCreate9Ex(D3D_SDK_VERSION, &p_Object)))
                exit(1);
 
        ZeroMemory(&p_Params, sizeof(p_Params));    
    p_Params.Windowed = TRUE;  
    p_Params.SwapEffect = D3DSWAPEFFECT_DISCARD;    
    p_Params.hDeviceWindow = hWnd;    
    p_Params.MultiSampleQuality   = D3DMULTISAMPLE_NONE;
    p_Params.BackBufferFormat = D3DFMT_A8R8G8B8 ;    
    p_Params.BackBufferWidth = Width;    
    p_Params.BackBufferHeight = Height;    
    p_Params.EnableAutoDepthStencil = TRUE;
    p_Params.AutoDepthStencilFormat = D3DFMT_D16;
 
        if(FAILED(p_Object->CreateDeviceEx(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &p_Params, 0, &p_Device)))
                exit(1);
 
        if(!p_Line)
                D3DXCreateLine(p_Device, &p_Line);
 
        D3DXCreateFont(p_Device, 18, 0, 0, 0, false, DEFAULT_CHARSET, OUT_CHARACTER_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, "Calibri", &pFontSmall);
 
        return 0;
}
 



void DrawESP(int x, int y, float distance)
{
    int width = 15000/distance;
    int height = 30000/distance;
    DrawBox(x-(width/2), y-height, width, height, 1, 255, 0, 0, 255);
}
 


int Render()
{
        p_Device->Clear(0, 0, D3DCLEAR_TARGET, 0, 1.0f, 0);
        p_Device->BeginScene();
 
        if(tWnd == GetForegroundWindow())
        {
                fProcess.RunProcess();
                for(int i = 0; i < NumOfPlayers; i ++)
    {
        PlayerList[i].ReadInformation(i);
 

                if(PlayerList[i].Health < 2)
                        continue;
 
                if(PlayerList[i].Team == MyPlayer.Team)
                        continue;
 
        float EnemyXY[3];

         if(WorldToScreen(PlayerList[i].Position, EnemyXY) || PlayerList[i].Team != MyPlayer.Team)
      // if(WorldToScreen(PlayerList[i].Position, EnemyXY) && PlayerList[i].Team != MyPlayer.Team)
		//if(WorldToScreen(PlayerList[i].Position, EnemyXY))
        {
			DrawESP(EnemyXY[0] - m_Rect.left, EnemyXY[1] - m_Rect.top , Get3dDistance(MyPlayer.Position, PlayerList[i].Position));
                }
        }
 
        }
 
       p_Device->EndScene();
       p_Device->PresentEx(0, 0, 0, 0, 0);
       return 0;
}
 

brinkz

Coder
Meme Tier VIP
Sep 3, 2012
209
1,688
12
Why don't you log every value you pass to the functions you use?
 

cskimmo69

Newbie
Full Member
Nobleman
Jul 7, 2013
36
318
0
Why don't you log every value you pass to the functions you use?
Why would i? Im noob i dont know why should i log.. i ported the gdi one what works with same stuff, offsets, wts and those but i cant get this working with this because im stupid piece of shit!!!!!!!
 

c5

Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
Jul 19, 2012
1,187
19,938
76
Why would i? Im noob i dont know why should i log.. i ported the gdi one what works with same stuff, offsets, wts and those but i cant get this working with this because im stupid piece of shit!!!!!!!
Log for the sake of learning? With that kind of attitude nobody is willing to help you, if you aren't willing to put any effort into it yourself and hope everything will be done for you... :facepalm:
 

cskimmo69

Newbie
Full Member
Nobleman
Jul 7, 2013
36
318
0
Log for the sake of learning? With that kind of attitude nobody is willing to help you, if you aren't willing to put any effort into it yourself and hope everything will be done for you... :facepalm:
What do you guys mean i should log? ok i log but what ? values like vmatrix or ? im tried to solve this now 2hours... tried to look if getting resolution was wrong but its ok, and distance its ok too and wts should be ok its like in gdi one but i dont know how it afffects in directx or does it matter sorry for my shitty english.
 

TastyHorror

Coder
Dank Tier Donator
Nobleman
Oct 11, 2012
179
2,268
8
Wow 2 hours. Mate in all fairness, if you want something to be done, LEARN. Don't just copy and paste and expect it to work.. If those 2 hours is the limit of your patience - give up now; some of us here spend days debugging their code..
Also 2 hours is nothing. I've searched for a health address when I started learning how to make cheats for about 8+ hours.
 

cskimmo69

Newbie
Full Member
Nobleman
Jul 7, 2013
36
318
0
I didnt say i stop im still trying to fix just gave a little break and came here to cry for some help
 
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.

Similar threads

Community Mods