Don't like ads? PRO users don't see any ads ;-)
Guest

ESP

By: a guest on Aug 19th, 2012  |  syntax: C++  |  size: 13.04 KB  |  hits: 164  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #define NAMESIZE 0x21
  2. #define OFS_NAMES 0x5D2C
  3. #define OFS_HEALTH       0x344
  4. #define HPSIZE   0x1C
  5. #define MAXPLAYERS       16
  6. #define PLAYERSIZE       0x11A8
  7. #define OFS_BASEPLAYER  0x631A58
  8. #define OFS_PLAYER       0x74BC
  9. #define OFS_TEAM         0x6150
  10. #define OFS_RDATA        0x189080
  11.  
  12.  
  13. #define OFS_Grade 0x5AD1
  14. #define GradeSIZE 0x26
  15.  
  16.  
  17.  
  18. CHAR FrameRate[20] = "[+]";
  19.  
  20.  
  21. DWORD dwGFX      = (DWORD)GetModuleHandle("i3GfxDx.dll");
  22. RenderContext *pRC       = (RenderContext*)(dwGFX + OFS_RDATA);
  23.  
  24.  
  25.  
  26. bool WorldToScreen(D3DVECTOR Player,D3DVECTOR &PlayerScaled)
  27. {      
  28. D3DXVECTOR3 PlayerPos(Player.x,Player.y,Player.z);
  29. D3DXMATRIX identity;
  30. D3DXVECTOR3 vScreen;
  31.  
  32. npDevice->GetViewport(&g_ViewPort);
  33. g_ViewPort.X = g_ViewPort.Y = 0;
  34. g_ViewPort.MinZ = 0;
  35. g_ViewPort.MaxZ = 1;
  36. D3DXVec3Project(&vScreen, &PlayerPos, &g_ViewPort, &pRC->pRenderData->ProjMatrix, &pRC->pRenderData->ViewMatrix, &pRC->pRenderData->GetWorldMatrix);
  37.  
  38. if (vScreen.z < 1.0f && vScreen.x > 0.0f && vScreen.y > 0.0f && vScreen.x < g_ViewPort.Width && vScreen.y < g_ViewPort.Height)
  39. {
  40. PlayerScaled.x = vScreen.x;
  41. PlayerScaled.y = vScreen.y ;
  42. PlayerScaled.z = vScreen.z;
  43.  
  44. return true;
  45. }
  46. return false;
  47. }
  48.  
  49.  
  50.  
  51.  
  52.  
  53. void FillRGB( float x, float y, float w, float h, D3DCOLOR color)
  54. {
  55. if( w < 0 )w = 1;
  56. if( h < 0 )h = 1;
  57. if( x < 0 )x = 1;
  58. if( y < 0 )y = 1;
  59.  
  60. D3DRECT rec = { x, y, x + w, y + h };
  61. npDevice->Clear( 1, &rec, D3DCLEAR_TARGET, color, 0, 0 );
  62. }
  63.  
  64.  
  65.  
  66.  
  67. void DrawBox1(float x, float y, float w, float h, D3DCOLOR color )
  68. {
  69. D3DRECT rec;
  70. rec.x1 = x;
  71. rec.x2 = x + w;
  72. rec.y1 = y;
  73. rec.y2 = y + h;
  74. npDevice->Clear( 1, &rec, D3DCLEAR_TARGET, color, 0, 0 );
  75. }
  76.  
  77.  
  78.  
  79.  
  80.  
  81. void DrawString(float x, float y , DWORD color, const char *fmt, ...)
  82. {
  83. RECT FontPos = { x, y, x + 20, y + 10 };
  84. char buf[1024] = {'\0'};
  85. va_list va_alist;
  86. va_start(va_alist, fmt);
  87. vsprintf(buf, fmt, va_alist);
  88. va_end(va_alist);
  89. g_pFont->DrawText(NULL, buf, -1, &FontPos, DT_NOCLIP, color);
  90. }
  91.  
  92.  
  93.  
  94. D3DVECTOR HeadPos;
  95. D3DVECTOR FootPos;
  96. D3DVECTOR ScreenPos;
  97.  
  98.  
  99.  
  100. #define BLACK    D3DCOLOR_ARGB(150, 000, 000, 000)
  101. #define WHITE    D3DCOLOR_ARGB(255, 255, 255, 255)
  102. #define RED      D3DCOLOR_ARGB(255, 255, 000, 000)
  103. #define GREEN    D3DCOLOR_ARGB(255, 000, 255, 000)
  104. #define YELLOW   D3DCOLOR_ARGB(255, 255, 255, 000)
  105. #define BLUE     D3DCOLOR_ARGB(255, 000, 000, 255)
  106. #define SKYBLUE  D3DCOLOR_ARGB(255, 0, 180, 255)
  107. #define RED2     D3DCOLOR_ARGB(100, 255, 000, 000)
  108.  
  109.  
  110.  
  111. void DrawBorder( float x, float y, float w, float h, int px, float Health)
  112. {
  113. DWORD HPcol = GREEN;
  114. if (Health < 90 )HPcol = BLUE;
  115. if (Health < 70 )HPcol = SKYBLUE;
  116. if (Health < 50 )HPcol = YELLOW;
  117. if (Health < 30) HPcol = RED;
  118. if (Health < 10) HPcol = RED2;
  119. if (Health = 0) HPcol = BLACK;
  120. FillRGB( x, (y + h - px), w, px, HPcol);
  121. FillRGB( x, y, px, h, HPcol);
  122. FillRGB( x, y, w, px, HPcol);
  123. FillRGB( (x + w - px), y, px, h, HPcol);       
  124. }
  125.  
  126.  
  127. void FillRGB3( int x, int y, int w, int h, D3DCOLOR color, IDirect3DDevice9* pDevice )
  128. {
  129. if( w < 0 )w = 1;
  130. if( h < 0 )h = 1;
  131. if( x < 0 )x = 1;
  132. if( y < 0 )y = 1;
  133.  
  134. D3DRECT rec = { x, y, x + w, y + h };
  135. pDevice->Clear( 1, &rec, D3DCLEAR_TARGET, color, 0, 0 );
  136. }
  137.  
  138.  
  139.  
  140. void DrawBorder333( int x, int y, int w, int h, int px, D3DCOLOR BorderColor, IDirect3DDevice9* pDevice )
  141. {
  142. FillRGB3( x, (y + h - px), w, px, BorderColor, pDevice );
  143. FillRGB3( x, y, px, h, BorderColor, pDevice );
  144. FillRGB3( x, y, w, px, BorderColor, pDevice );
  145. FillRGB3( (x + w - px), y, px, h, BorderColor, pDevice );
  146. }
  147.  
  148.  
  149.  
  150.  
  151.  
  152. void Healthbar(int x, int y, float Health)
  153. {
  154. DWORD HPcol = GREEN;
  155. if (Health < 90 )HPcol = BLUE;
  156. if (Health < 70 )HPcol = SKYBLUE;
  157. if (Health < 50 )HPcol = YELLOW;
  158. if (Health < 30) HPcol = RED;
  159. if (Health < 10) HPcol = RED2;
  160. DrawBorder333(x-1,y-1,50,6,1,BLACK,npDevice);
  161. FillRGB3(x,y,Health/2,4,HPcol,npDevice);
  162. }
  163.  
  164.  
  165. void DrawRectangle(float x, float y, float w, int h)
  166. {
  167. D3DXVECTOR2 vLine1[2];
  168. D3DXVECTOR2 vLine2[2];
  169. D3DXVECTOR2 vLine3[2];
  170. D3DXVECTOR2 vLine4[2];
  171. vLine1[0].x = x;
  172. vLine1[0].y = y;
  173. vLine1[1].x = x;
  174. vLine1[1].y = y+h;
  175. vLine2[0].x = x+w;
  176. vLine2[0].y = y;
  177. vLine2[1].x = x+w;
  178. vLine2[1].y = y+h;
  179. vLine3[0].x = x;
  180. vLine3[0].y = y;
  181. vLine3[1].x = x+w;
  182. vLine3[1].y = y;
  183. vLine4[0].x = x;
  184. vLine4[0].y = y+h;
  185. vLine4[1].x = x+w;
  186. vLine4[1].y = y+h;
  187. g_pLine->SetWidth(2);
  188. g_pLine->SetAntialias(false);
  189. g_pLine->SetGLLines(false);
  190. g_pLine->Begin();
  191. g_pLine->Draw(vLine1, 2, 0xFF0000FF);
  192. g_pLine->Draw(vLine2, 2, 0xFF0000FF);
  193. g_pLine->Draw(vLine3, 2, 0xFF0000FF);
  194. g_pLine->Draw(vLine4, 2, 0xFF0000FF);
  195. g_pLine->End();
  196.  
  197. }
  198.  
  199. void DrawLine ( long Xa, long Ya, long Xb, long Yb, DWORD dwWidth, float Health)
  200. {      
  201. DWORD HPcol = GREEN; // Deklarasi Health Protection Color
  202. if (Health < 90 )HPcol = BLUE; // Jika HP Di Bawah 90 = Color
  203. if (Health < 70 )HPcol = SKYBLUE; // Jika HP Di Bawah 70 = Color
  204. if (Health < 50 )HPcol = YELLOW; // Jika HP Di Bawah 50 = Color
  205. if (Health < 30) HPcol = RED; // Jika HP Di Bawah 30 = Color
  206. if (Health < 10) HPcol = RED2; // Jika HP Di Bawah 10 = Color
  207. if (Health = 0) HPcol = BLACK; // Jika HP Di Bawah 10 = Color
  208. D3DXVECTOR2 vLine[ 2 ]; // 2 Poin
  209. g_pLine->SetAntialias( 0 ); // Set Tepi
  210. g_pLine->SetWidth( dwWidth ); // Lebar Dari Line
  211. g_pLine->Begin();
  212. vLine[ 0 ][ 0 ] = Xa; // Jadikan Point Menjadi Array
  213. vLine[ 0 ][ 1 ] = Ya;
  214. vLine[ 1 ][ 0 ] = Xb;
  215. vLine[ 1 ][ 1 ] = Yb;
  216. g_pLine->Draw( vLine, 2, HPcol ); // Draw Garis , Jumlah Garis , Warna Garis
  217. g_pLine->End(); // Selesai
  218. }
  219.  
  220.  
  221. ID3DXLine *pLine; //Deklarasi pLine
  222.  
  223.  
  224. void Draw3DBox(float x_bottom_left, float y_bottom_left, float x_bottom_right, float y_bottom_right, float x_top_left, float y_top_left, float x_top_right, float y_top_right, float x_forward_bottom_left, float y_forward_bottom_left, float x_forward_bottom_right, float y_forward_bottom_right, float x_forward_top_left, float y_forward_top_left, float x_forward_top_right, float y_forward_top_right, int a, int r, int g, int b)
  225. {
  226. if(!IsBadReadPtr(pLine, sizeof(ID3DXLine)))
  227. {
  228. D3DXVECTOR2 vLine1[2];
  229. D3DXVECTOR2 vLine2[2];
  230. D3DXVECTOR2 vLine3[2];
  231. D3DXVECTOR2 vLine4[2];
  232. D3DXVECTOR2 vLine5[2];
  233. D3DXVECTOR2 vLine6[2];
  234. D3DXVECTOR2 vLine7[2];
  235. D3DXVECTOR2 vLine8[2];
  236. D3DXVECTOR2 vLine9[2];
  237. D3DXVECTOR2 vLine10[2];
  238. D3DXVECTOR2 vLine11[2];
  239. D3DXVECTOR2 vLine12[2];
  240.  
  241. float t=1;
  242. pLine->SetWidth( t );
  243. pLine->SetAntialias( false );
  244. pLine->SetGLLines( false );
  245.  
  246. //bottom left to bottom right
  247. vLine1[0].x = x_bottom_left;
  248. vLine1[0].y = y_bottom_left;
  249. vLine1[1].x = x_bottom_left+(x_bottom_right-x_bottom_left);
  250. vLine1[1].y = y_bottom_left;
  251.  
  252. //bottom left to top left
  253. vLine2[0].x = x_top_left;
  254. vLine2[0].y = y_top_left;
  255. vLine2[1].x = x_top_left;
  256. vLine2[1].y = y_top_left+(y_bottom_left-y_top_left);
  257.  
  258. //bottom right to top right
  259. vLine3[0].x = x_top_right;
  260. vLine3[0].y = y_top_right;
  261. vLine3[1].x = x_top_right;
  262. vLine3[1].y = y_top_right+(y_bottom_right-y_top_right);
  263.  
  264. //top left to top right
  265. vLine4[0].x = x_top_left;
  266. vLine4[0].y = y_top_left;
  267. vLine4[1].x = x_top_left+(x_top_right-x_top_left);
  268. vLine4[1].y = y_top_left;
  269.  
  270. //from top left to top left forward
  271. vLine5[0].x = x_top_left;
  272. vLine5[0].y = y_top_left;
  273. vLine5[1].x = x_top_left+(x_forward_top_left-x_top_left);
  274. vLine5[1].y = y_top_left+(y_forward_top_left-y_top_left);
  275.  
  276. //from bottom left to bottom left forward
  277. vLine6[0].x = x_bottom_left;
  278. vLine6[0].y = y_bottom_left;
  279. vLine6[1].x = x_bottom_left+(x_forward_bottom_left-x_bottom_left);//
  280. vLine6[1].y = y_bottom_left+(y_forward_bottom_left-y_bottom_left);//
  281.  
  282. //from bottom right to bottom right forward
  283. vLine7[0].x = x_bottom_right;
  284. vLine7[0].y = y_bottom_right;
  285. vLine7[1].x = x_bottom_right+(x_forward_bottom_right-x_bottom_right);//
  286. vLine7[1].y = y_bottom_right+(y_forward_bottom_right-y_bottom_right);//
  287.  
  288. //from top right to top right forward
  289. vLine8[0].x = x_top_right;
  290. vLine8[0].y = y_top_right;
  291. vLine8[1].x = x_top_right+(x_forward_top_right-x_top_right);//
  292. vLine8[1].y = y_top_right+(y_forward_top_right-y_top_right);//
  293.  
  294. //bottom left forward to bottom right forward
  295. vLine9[0].x = x_forward_bottom_left;
  296. vLine9[0].y = y_forward_bottom_left;
  297. vLine9[1].x = x_forward_bottom_left+(x_forward_bottom_right-x_forward_bottom_left);
  298. vLine9[1].y = y_forward_bottom_left;
  299.  
  300. //bottom left forward to top left forward
  301. vLine10[0].x = x_forward_top_left;
  302. vLine10[0].y = y_forward_top_left;
  303. vLine10[1].x = x_forward_top_left;
  304. vLine10[1].y = y_forward_top_left+(y_forward_bottom_left-y_forward_top_left);
  305.  
  306. //bottom right forward to top right forward
  307. vLine11[0].x = x_forward_top_right;
  308. vLine11[0].y = y_forward_top_right;
  309. vLine11[1].x = x_forward_top_right;
  310. vLine11[1].y = y_forward_top_right+(y_forward_bottom_right-y_forward_top_right);
  311.  
  312. //top left forward to top right forward
  313. vLine12[0].x = x_forward_top_left;
  314. vLine12[0].y = y_forward_top_left;
  315. vLine12[1].x = x_forward_top_left+(x_forward_top_right-x_forward_top_left);
  316. vLine12[1].y = y_forward_top_left;
  317.  
  318. pLine->Begin( );
  319. pLine->Draw( vLine1, 2, D3DCOLOR_ARGB(a, r, g, b ) );
  320. pLine->Draw( vLine2, 2, D3DCOLOR_ARGB(a, r, g, b ) );
  321. pLine->Draw( vLine3, 2, D3DCOLOR_ARGB(a, r, g, b ) );
  322. pLine->Draw( vLine4, 2, D3DCOLOR_ARGB(a, r, g, b ) );
  323. pLine->Draw( vLine5, 2, D3DCOLOR_ARGB(a, r, g, b ) );
  324. pLine->Draw( vLine6, 2, D3DCOLOR_ARGB(a, r, g, b ) );
  325. pLine->Draw( vLine7, 2, D3DCOLOR_ARGB(a, r, g, b ) );
  326. pLine->Draw( vLine8, 2, D3DCOLOR_ARGB(a, r, g, b ) );
  327. pLine->Draw( vLine9, 2, D3DCOLOR_ARGB(a, r, g, b ) );
  328. pLine->Draw( vLine10, 2, D3DCOLOR_ARGB(a, r, g, b ) );
  329. pLine->Draw( vLine11, 2, D3DCOLOR_ARGB(a, r, g, b ) );
  330. pLine->Draw( vLine12, 2, D3DCOLOR_ARGB(a, r, g, b ) );
  331. pLine->End( );
  332. }
  333. }
  334.  
  335.  
  336. /*void DrawHealthbar(int x, int y, int w, int h, D3DCOLOR barCol, D3DCOLOR borCol, int hp, int maxhp)
  337. {
  338. FillRGB(x, y, ( hp / (double)maxhp ) * w, h, barCol, pDevice);
  339. DrawBorder(x, y, w, h, Green, Green);
  340. }*/
  341.  
  342.  
  343. static char FinalString[260];
  344. #define OFS_BASEPLAYER2 0x631A24
  345.  
  346. char dis[64];
  347.  
  348.  
  349. DWORD dwPointer;
  350. D3DXMATRIX ProjMatrix, World, ViewMatrix;//Place At Top Of Your Source Code
  351. bool DxInit = false;
  352.  
  353.  
  354. float FindDistance(D3DXVECTOR3 my,D3DXVECTOR3 other,CPlayers* pPlayer,CPlayers* pLocal)
  355. {
  356. return sqrt((pLocal->pos.x-pPlayer->pos.x)*(pLocal->pos.x-pPlayer->pos.x) + (pLocal->pos.y-pPlayer->pos.y)*(pLocal->pos.y-pPlayer->pos.y) + (pLocal->pos.z-pPlayer->pos.z)*(pLocal->pos.z-pPlayer->pos.z));
  357. }
  358.  
  359. void DrawESP()
  360. {
  361.  
  362. DWORD dwI3EXEC   = (DWORD)GetModuleHandle("PointBlank.exe");
  363. unsigned long dwBase    = *(DWORD*)(dwI3EXEC + OFS_BASEPLAYER);
  364. unsigned long dwBase2   = *(DWORD*)(dwI3EXEC + OFS_BASEPLAYER2);
  365. CTeam    *pTeam  = ((CTeam*)(dwBase + OFS_TEAM));
  366.  
  367. D3DVECTOR ScreenPos;
  368.  
  369.  
  370. for (int i = 0; i <= 16; i++)
  371. {
  372. CPlayers        *pPlayer        = (CPlayers*)((dwBase + OFS_PLAYER) + i * PLAYERSIZE);
  373. CPlayers        *pLocal  = (CPlayers*)((dwBase + OFS_PLAYER) + pTeam->iTeam * PLAYERSIZE);
  374. CNames *PNames = (CNames*) ((dwBase + OFS_NAMES) + NAMESIZE * i);
  375. CGrade *PGrade = (CGrade*) ((dwBase + OFS_Grade) + GradeSIZE * i);
  376. CHealth  *pHealth       = (CHealth*) ((dwBase2+ OFS_HEALTH) + i * HPSIZE);
  377. HeadPos.x       =       pPlayer->pos.x;
  378. HeadPos.y       =       1.5f + pPlayer->pos.y;
  379. HeadPos.z       =       pPlayer->pos.z;
  380. FootPos.x       =       pPlayer->pos.x;
  381. FootPos.y       =       pPlayer->pos.y;
  382. FootPos.z       =       pPlayer->pos.z;
  383. D3DXVECTOR3 xDistance   =       pPlayer->pos - pLocal->pos;
  384. D3DXVECTOR3 MyDistance  =       pLocal->pos - pPlayer->pos;
  385. float xaDistance        = D3DXVec3Length(&xDistance );
  386. float MyaDistance       = D3DXVec3Length(&MyDistance );
  387.  
  388. if (WorldToScreen(pPlayer->pos,ScreenPos))
  389. {      
  390.  
  391. if(pHealth->CurHP > 1)
  392. {
  393.  
  394. if (esphp == 1)
  395. {
  396. Healthbar((int)ScreenPos.x-23,(int)ScreenPos.y+15,pHealth->CurHP);
  397. }
  398.  
  399. if (ESPHack == 1)
  400. {
  401. DrawBorder(ScreenPos.x-(10000/MyaDistance)/40,ScreenPos.y-(35000/MyaDistance)/40,50000/MyaDistance/6*2/40,50000/MyaDistance/3*2/40,1,pHealth->CurHP);
  402. }
  403.  
  404. if(LineESP == 1)
  405. {
  406. DrawLine(ScreenCenterX,ScreenCenterY+550,ScreenPos.x-10,ScreenPos.y+20,1,pHealth->CurHP);      
  407. }
  408.  
  409. if (DrawStringESP == 1)
  410. {
  411. DrawString(ScreenPos.x+10,ScreenPos.y-25,WHITE,"Name : [%s]",PNames->szNames);
  412. }
  413.  
  414.  
  415. if (HealthBarDD == 1)
  416. {
  417. DrawString(ScreenPos.x+10,ScreenPos.y-35,YELLOW,"Clan : [%s] ",PGrade->szGrade);
  418. }
  419.  
  420.  
  421. }
  422. }
  423. }
  424. }
  425.  
  426. ClassESP :
  427. Code:
  428.  
  429. #include <windows.h>
  430. #include <stdio.h>
  431. #include <string>
  432. #include <d3d9.h>
  433. #include <d3dx9.h>
  434. #include <tchar.h>
  435. #include <iostream>
  436. #include <d3dx9math.h>
  437. #include <fstream>
  438. #include <time.h>
  439. #include <vector>
  440. #include <math.h>
  441. #include <fstream>
  442. #include <cmath>
  443. #pragma comment(lib, "d3d9.lib")
  444. #pragma comment(lib, "d3dx9.lib")
  445.  
  446. class RenderContext;
  447. class RenderData;
  448. class CPlayers;
  449. class CTeam;
  450.  
  451. class CPlayers
  452. {
  453. public:
  454. float yaw;
  455. float pitch;
  456. D3DXVECTOR3 pos;
  457. char unkno8[2704];
  458. };
  459.  
  460. struct CNames
  461. {
  462. char szNames[33];//21
  463. };
  464.  
  465.  
  466. struct CGrade
  467. {
  468. char szGrade[33];//21
  469. };
  470.  
  471.  
  472. class RenderContext
  473. {
  474. public:
  475. RenderData* pRenderData;
  476. char unknown4[1076];
  477. D3DXVECTOR3 bone;
  478. D3DXVECTOR3 bone1;
  479. D3DXVECTOR3 bone2;
  480. };
  481.  
  482. class _Object
  483. {
  484. public:
  485. char Pad[4];
  486. D3DXVECTOR3 origin;
  487. };
  488.  
  489.  
  490. struct CHealth
  491. {
  492. float CurHP;
  493. };
  494.  
  495.  
  496. struct DHealth
  497. {
  498. char STRHP;
  499. };
  500.  
  501.  
  502. class RenderData
  503. {
  504. public:
  505. char unknown0[2400];
  506. D3DXMATRIX ViewMatrix;
  507. D3DXMATRIX ProjMatrix;
  508. D3DXMATRIX GetWorldMatrix;
  509. D3DXMATRIX WorldView[80];
  510. };
  511.  
  512. class CTeam
  513. {
  514. public:
  515. BYTE iTeam;
  516. };