Advertisement
ahmedhamdy21

Untitled

Sep 24th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.68 KB | None | 0 0
  1. int setup=0;
  2.  
  3.  
  4. DWORD CShell_LiM;
  5. int* GameStatus;
  6.  
  7. std::string FormatString(std::string one, std::string two, std::string three) {
  8. return std::string(one+=two+=three);
  9. };
  10.  
  11. int GetD3DTextWidth(LPD3DXFONT pFont, std::string szText) {
  12. RECT rcRect = {0,0,0,0};
  13. if (pFont) {
  14. pFont->DrawText(NULL, szText.c_str(), strlen(szText.c_str()), &rcRect, DT_CALCRECT, D3DCOLOR_ARGB(0,0, 0, 0));
  15. }
  16. return rcRect.right - rcRect.left;
  17. };
  18.  
  19. void DrawD3DText(LPD3DXFONT pFont, int x, int y, int z, D3DCOLOR color, std::string szText) {
  20. RECT rct;
  21. rct.left=x;
  22. rct.right=z;
  23. rct.top=y;
  24. rct.bottom=rct.top+200;
  25. pFont->DrawText(NULL, szText.c_str(), -1, &rct, DT_CENTER, color);
  26. };
  27. struct D3DTLVERTEX
  28. {
  29. float x, y, z, rhw;
  30. DWORD color;
  31. };
  32. void DrawD3DLine (LPDIRECT3DDEVICE9 pDevice, float X, float Y, float X2, float Y2, DWORD dwColor)
  33. {
  34. D3DTLVERTEX qV[2] =
  35. {
  36. {(float)X, (float)Y, 0.0f, 1.0f, dwColor},
  37. {(float)X2, (float)Y2, 0.0f, 1.0f, dwColor},
  38. };
  39. pDevice->SetFVF(D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1);
  40. pDevice->DrawPrimitiveUP(D3DPT_LINELIST, 1, qV, sizeof(D3DTLVERTEX));
  41. }
  42.  
  43. void espme(LPDIRECT3DDEVICE9 pDevice) {
  44. if(setup==0){
  45. CShell_LiM = reinterpret_cast<DWORD>(GetModuleHandle("CShell.dll"));
  46. GameStatus = reinterpret_cast<int*>(CShell_LiM + GameStatus_Address);
  47. setup=1;
  48. };
  49. if ((GameStatus != NULL) && *GameStatus == 11) {
  50. DWORD ltclientshell = *reinterpret_cast<DWORD*>(CShell_LiM + 0x11F7F34);
  51. CPlayer* LocalPlayer = reinterpret_cast<CPlayer*>(GetPlayerByIndex(ltclientshell, GetMyIndex(ltclientshell)));
  52. for (int Key = 0; (Key <= 15); Key++) {
  53. CPlayer* Player = reinterpret_cast<CPlayer*>(GetPlayerByIndex(ltclientshell, Key));
  54. if (isValidClient(Player) && (Player != LocalPlayer)) {
  55. D3DXVECTOR3 PlayerBody = GetBonePosition((Player -> Object), 2);
  56. WorldToScreen(pDevice, &PlayerBody);
  57. D3DCOLOR ESPColor = (((LocalPlayer -> Team) == (Player -> Team)) ? D3DCOLOR_ARGB(255, 0, 255, 0) : D3DCOLOR_ARGB(255, 255, 0, 0));
  58. std::string PlayerName = FormatString("[", (Player -> Name), "]");
  59. int PlayerName_Width = GetD3DTextWidth(pFont, PlayerName);
  60. DrawD3DText(pFont, (PlayerBody.x - (PlayerName_Width / 2)), (PlayerBody.y - 45), PlayerName_Width, ESPColor, PlayerName);
  61. char* health;
  62. itoa(Player->Health, health, 10);
  63. std::string PlayerHealth = FormatString("[Health: ", health, "]");
  64. int PlayerHealth_Width = GetD3DTextWidth(pFont, PlayerHealth);
  65. DrawD3DText(pFont, (PlayerBody.x - (PlayerHealth_Width / 2)), (PlayerBody.y + 35), PlayerHealth_Width, ESPColor, PlayerHealth);
  66. DrawD3DLine(pDevice, (GetSystemMetrics(SM_CXSCREEN) / 2), 0, PlayerBody.x, PlayerBody.y, ESPColor);
  67. };
  68. };
  69. };//
  70. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement