OldSchoolHack

Register / Login English

Css Hack Code Falsch?

icon Thread: Css Hack Code Falsch?

Join Date: Dec 2009

Posts: 51

Hallo,

Was ist den an diesen code Falsch

TEXT Code:
  1. #include <iostream.h>
  2.  
  3. using namespace std;
  4.  
  5. cLocalPlayer gLocalPlayer;
  6.  
  7. char szpath[1024];
  8. char szlogfile[1024];
  9. bool bGotPath = false;
  10. void __cdecl add_log(const char * fmt, ...)
  11. {
  12. va_list va_alist;
  13. char logbuf[256];
  14. FILE *fp;
  15. char szLogFile[256];
  16. struct tm *current_tm;
  17. time_t current_time;
  18.  
  19. time (¤t_time);
  20. current_tm = localtime (¤t_time);
  21.  
  22. sprintf (logbuf, \"[%02d:%02d:%02d] \", current_tm->tm_hour, current_tm->tm_min, current_tm->tm_sec);
  23.  
  24. va_start (va_alist, fmt);
  25. _vsnprintf (logbuf+strlen(logbuf), sizeof(logbuf) - strlen(logbuf), fmt, va_alist);
  26. va_end (va_alist);
  27.  
  28. if( !bGotPath )
  29. {
  30. bGotPath = true;
  31. GetModuleFileName( 0, szpath, 1024 );
  32. }
  33. strcpy(szlogfile, szpath);
  34. strcpy(&szlogfile[strlen(szlogfile) - 3], \"log\");
  35. if ( (fp = fopen ( szlogfile , \"a\")) != NULL )
  36. {
  37. fprintf ( fp, \"%sn\", logbuf );
  38. fclose (fp);
  39. }
  40. }
  41.  
  42. // Global Variables:
  43. DWORD dwPID = 0;
  44. HANDLE hProcess;
  45.  
  46. DWORD m_EntPtrArray;
  47. DWORD dwClient_DLL;
  48. DWORD dwEngine_DLL;
  49. DWORD dwVGUIMatSurface_DLL;
  50.  
  51. DWORD dwLocalViewangles;
  52. DWORD dwCmdViewangles;
  53. DWORD dwScreenSize;
  54.  
  55. // Pre-Declarations:
  56. DWORD GetModuleBaseExtern( DWORD dwPID, char* szModuleName );
  57. int GetLocalPlayer( void );
  58. bool InGame( void );
  59. void ESP( void );
  60. void DrawBox(HDC context, int x, int y, int r, int g, int b, int size, int thickness);
  61. void DrawString( HDC context, int x, int y, int r, int g, int b, char* text, bool center );
  62.  
  63. struct sPlayer
  64. {
  65. DWORD m_dwAddress;
  66. float m_vecOrigin[3];
  67. float m_f2DCoordinates[2];
  68. float m_fViewangles[3];
  69. unsigned int m_iTeamNum;
  70. unsigned int m_iHealth;
  71. unsigned int m_lifeState;
  72. unsigned int m_bIsPlayer;
  73. unsigned int m_fFlags;
  74. unsigned int m_iFOV;
  75. unsigned int m_bDormant;
  76. COLORREF m_clrTeamColor;
  77. };
  78. sPlayer Players[32];
  79.  
  80. struct sGame
  81. {
  82. unsigned int m_bInGame;
  83. };
  84. sGame Game;
  85.  
  86. struct sGameWindow
  87. {
  88. HWND hWindow;
  89. HDC hDC;
  90. unsigned int m_iCaptionHeight;
  91. RECT m_Rect;
  92. unsigned int m_iSize[2];
  93. unsigned int m_iResolution[2];
  94. unsigned int m_iDisplayCenter[2];
  95. };
  96. sGameWindow GameWindow;
  97.  
  98. unsigned int g_iCaptionHeight;
  99. unsigned int g_iBorderWidth;
  100. unsigned int g_iDisplayCenter[2];
  101. unsigned int m_iMin[2];
  102. unsigned int m_iMax[2];
  103.  
  104. int APIENTRY _tWinMain(HINSTANCE hInstance,
  105. HINSTANCE hPrevInstance,
  106. LPTSTR lpCmdLine,
  107. int nCmdShow)
  108. {
  109. char szMutex[256];
  110. GetModuleFileName( 0, szMutex, 256 );
  111. for( int i = 0; i < ( int )strlen( szMutex ); i++ )
  112. {
  113. if( szMutex[ strlen( szMutex ) - i ] == \'\' )
  114. {
  115. //szMutex[ ( strlen( szMutex ) - i ) + 1 ] = \'\';
  116. sprintf( szMutex, szMutex + ( strlen( szMutex ) - i + 1 ) );
  117. break;
  118. }
  119. }
  120. CreateMutex( 0, FALSE, \"extern0r\" );
  121. if( GetLastError() )
  122. {
  123. char szMessage[256];
  124. sprintf( szMessage, \"%s is already running!\", szMutex );
  125. MessageBox( 0, szMessage, \"Error\", MB_ICONERROR );
  126. return true;
  127. }
  128. add_log( \"[*] ---------- Session started ---------- \" );
  129. add_log( \"[*] ReadProcessMemory only ESP by laser122\" );
  130. add_log( \"[*] waiting for Couter-Strike Source\" );
  131. while( !( GameWindow.hWindow = FindWindow( NULL, \"Counter-Strike Source\" ) ) )
  132. Sleep(10);
  133.  
  134. SetForegroundWindow( GameWindow.hWindow );
  135.  
  136. while( !( GetForegroundWindow() == GameWindow.hWindow ) )
  137. Sleep(10);
  138.  
  139. while( !( GameWindow.hDC = /*GetDC(0)*/GetWindowDC( GameWindow.hWindow ) ) )
  140. Sleep(10);
  141.  
  142. add_log( \"[*] Counter-Strike Source has been found\" );
  143.  
  144. GetWindowThreadProcessId( GameWindow.hWindow, &dwPID );
  145.  
  146. add_log( \"[*] PID: %u\", dwPID );
  147.  
  148. while( !( hProcess = OpenProcess( PROCESS_ALL_ACCESS, false, dwPID ) ) )
  149. Sleep(10);
  150.  
  151. add_log( \"[*] Opened process\" );
  152.  
  153. while( !( dwEngine_DLL = GetModuleBaseExtern( dwPID, \"engine\" ) ) )
  154. Sleep(10);
  155. add_log( \"[*] engine.dll [0x%.8X]\", dwEngine_DLL );
  156.  
  157. while( ! ( dwClient_DLL = GetModuleBaseExtern( dwPID, \"client\" ) ) )
  158. Sleep(10);
  159. add_log( \"[*] client.dll [0x%.8X]\", dwClient_DLL );
  160.  
  161. //m_EntPtrArray = 0x243CD17C
  162. m_EntPtrArray = ( dwClient_DLL + 0x3CD17C );
  163.  
  164. //not needed yet
  165. while( !( dwVGUIMatSurface_DLL = GetModuleBaseExtern( dwPID, \"vguimatsurface\" ) ) )
  166. Sleep(10);
  167. add_log( \"[*] vguimatsurface.dll [0x%.8X]\", dwVGUIMatSurface_DLL );
  168.  
  169. dwLocalViewangles = ( dwEngine_DLL + 0x3943D0 );
  170. add_log( \"[*] Local viewangles [0x%.8X]\", dwLocalViewangles );
  171.  
  172. //client.dll+3FB344
  173. //same here
  174. dwCmdViewangles = ( dwEngine_DLL+ 0x3FB344 );
  175. add_log( \"[*] cmd->viewangles [0x%.8X]\", dwCmdViewangles );
  176.  
  177. dwScreenSize = ( dwEngine_DLL+ 0x5357C8 );
  178. ReadProcessMemory( hProcess, (PVOID)( dwEngine_DLL + 0x5357C8 ), &GameWindow.m_iSize, 8, NULL );
  179. add_log( \"[*] Windowwidth: %u Windowheight: %u\", GameWindow.m_iSize[0], GameWindow.m_iSize[1] );
  180.  
  181. CreateThread( 0, 0, (LPTHREAD_START_ROUTINE)ESP, 0, 0, 0 );
  182.  
  183. while( FindWindow( NULL, \"Counter-Strike Source\" ) )
  184. Sleep(10);
  185.  
  186. add_log( \"[*] Counter-Strike Source closed...\" );
  187. add_log( \"[*] ---------- Session ended ---------- \" );
  188.  
  189. return true;
  190. }
  191.  
  192. // Global Functions:
  193. //credits to ~burN
  194. DWORD GetModuleBaseExtern( DWORD dwPID, char* szModuleName )
  195. {
  196. HANDLE hModuleSnap = INVALID_HANDLE_VALUE;
  197. MODULEENTRY32 me32;
  198.  
  199. hModuleSnap = CreateToolhelp32Snapshot( TH32CS_SNAPMODULE, dwPID );
  200. if ( hModuleSnap == INVALID_HANDLE_VALUE )
  201. return 0x0;
  202.  
  203. me32.dwSize = sizeof( MODULEENTRY32 );
  204.  
  205. if ( !Module32First( hModuleSnap, &me32 ) )
  206. {
  207. CloseHandle( hModuleSnap );
  208. return 0x0;
  209. }
  210. do
  211. {
  212. if ( strstr( me32.szModule, szModuleName ) )
  213. {
  214. CloseHandle( hModuleSnap );
  215. return (DWORD)me32.modBaseAddr;
  216. }
  217. }
  218. while( Module32Next( hModuleSnap, &me32 ) );
  219.  
  220. CloseHandle( hModuleSnap );
  221. return 0x0;
  222. }
  223.  
  224. /*int GetLocalPlayer( void )
  225. {
  226. ReadProcessMemory( hProcess, (PVOID)( dwEngine_DLL + 0x38FAF0 ), &LocalPlayer.m_iIndex, 4, NULL );
  227. //FIX
  228. LocalPlayer.m_iIndex += 2;
  229. return LocalPlayer.m_iIndex;
  230. }*/
  231.  
  232. bool InGame( void )
  233. {
  234. ReadProcessMemory( hProcess, (PVOID)( dwEngine_DLL + 0x38FA80 ), &Game.m_bInGame, 4, NULL );
  235.  
  236. if( Game.m_bInGame == 6 )
  237. {
  238. Game.m_bInGame = 1;
  239. return true;
  240. }
  241.  
  242. Game.m_bInGame = 0;
  243. return false;
  244. }
  245.  
  246. DWORD GetClientEntity( int index )
  247. {
  248. DWORD dwClientEntity = 0x0;
  249. ReadProcessMemory( hProcess, (PVOID)( m_EntPtrArray + ( index * 0x8 ) ), &dwClientEntity, 4, NULL );
  250. //FIX
  251. dwClientEntity -=0x8;
  252. return dwClientEntity;
  253. }
  254.  
  255. float GetDistance( float *origin )
  256. {
  257. float diff[3] = { gLocalPlayer.GetAbsOrigin()[0] - origin[0], gLocalPlayer.GetAbsOrigin()[1] - origin[1], gLocalPlayer.GetAbsOrigin()[2] - origin[2] };
  258. return (float)( sqrt( ( diff[0] * diff[0] ) + ( diff[1] * diff[1] ) + ( diff[2] * diff[2] ) ) );
  259. }
  260.  
  261. void AngleVectors( const vec3_t angles, vec3_t forward,
  262. vec3_t right, vec3_t up ) {
  263. float angle;
  264. static float sp, sy, cp, cy;
  265.  
  266. angle = angles[0] * ( M_PI / 180 );
  267. sp = sin( angle );
  268. cp = cos( angle );
  269.  
  270. angle = angles[1] * ( M_PI / 180 );
  271. sy = sin( angle );
  272. cy = cos( angle );
  273.  
  274. if( forward ) {
  275. forward[0] = cp*cy;
  276. forward[1] = cp*sy;
  277. forward[2] = -sp;
  278. }
  279. if( right || up ) {
  280. static float sr, cr;
  281.  
  282. angle = angles[2] * ( M_PI / 180 );
  283. sr = sin( angle );
  284. cr = cos( angle );
  285.  
  286. if( right ) {
  287. right[0] = -1*sr*sp*cy+-1*cr*-sy;
  288. right[1] = -1*sr*sp*sy+-1*cr*cy;
  289. right[2] = -1*sr*cp;
  290. }
  291. if( up ) {
  292. up[0] = cr*sp*cy+-sr*-sy;
  293. up[1] = cr*sp*sy+-sr*cy;
  294. up[2] = cr*cp;
  295. }
  296. }
  297. }
  298.  
  299. int iWindowSizeDifference[2];
  300. void UpdateWindowInfo( void )
  301. {
  302. ReadProcessMemory( hProcess, (PVOID)dwScreenSize, &GameWindow.m_iResolution, 8, NULL );
  303. GameWindow.m_iDisplayCenter[0] = GameWindow.m_iResolution[0]/2;
  304. GameWindow.m_iDisplayCenter[1] = GameWindow.m_iResolution[1]/2;
  305. g_iDisplayCenter[0] = GameWindow.m_iDisplayCenter[0];
  306. g_iDisplayCenter[1] = GameWindow.m_iDisplayCenter[1];
  307. GetWindowRect( GameWindow.hWindow, &GameWindow.m_Rect );
  308. GameWindow.m_iSize[0] = GameWindow.m_Rect.right - GameWindow.m_Rect.left;
  309. GameWindow.m_iSize[1] = GameWindow.m_Rect.bottom - GameWindow.m_Rect.top;
  310.  
  311. iWindowSizeDifference[0] = GameWindow.m_iSize[0] - GameWindow.m_iResolution[0];
  312. iWindowSizeDifference[1] = GameWindow.m_iSize[1] - GameWindow.m_iResolution[1];
  313.  
  314. g_iBorderWidth = ( iWindowSizeDifference[0] / 2 );
  315.  
  316. g_iCaptionHeight = GameWindow.m_iCaptionHeight = ( GameWindow.m_iSize[1] - ( iWindowSizeDifference[0] / 2 ) - GameWindow.m_iResolution[1] );
  317. }
  318.  
  319. void ResetPlayers( void )
  320. {
  321. for( int i = 0; i < 33; i++ )
  322. {
  323. Players[i].m_vecOrigin[0] = 0;
  324. Players[i].m_vecOrigin[1] = 0;
  325. Players[i].m_vecOrigin[2] = 0;
  326. }
  327. }
  328.  
  329. char szHealthEsp[12];
  330. wchar_t wc_tBuffer[50];//not needed
  331.  
  332. float fForward[3];
  333. float fRight[3];
  334. float fUp[3];
  335.  
  336. bool bPanic = false;
  337. void ESP( void )
  338. {
  339. while(true)
  340. {
  341. Sleep(1);
  342. UpdateWindowInfo();
  343.  
  344. if( GetAsyncKeyState( VK_F12 )&1 )
  345. bPanic = !bPanic;
  346.  
  347. if( !bPanic && InGame() )
  348. {
  349. ResetPlayers();
  350. for( int iIndex = 0; iIndex < 33; iIndex++ )
  351. {
  352. if( iIndex == gLocalPlayer.GetIndex() )
  353. continue;
  354.  
  355. Players[iIndex].m_dwAddress = GetClientEntity( iIndex );
  356.  
  357. if( Players[iIndex].m_dwAddress == NULL )
  358. continue;
  359.  
  360. ReadProcessMemory( hProcess, (PVOID)( Players[iIndex].m_dwAddress + 0x140 ) , &Players[iIndex].m_bDormant, 4, NULL );
  361. ReadProcessMemory( hProcess, (PVOID)( Players[iIndex].m_dwAddress + 0x42A ) , &Players[iIndex].m_bIsPlayer, 4, NULL );
  362.  
  363. if( Players[iIndex].m_bDormant || !Players[iIndex].m_bIsPlayer )
  364. continue;
  365.  
  366. ReadProcessMemory( hProcess, (PVOID)( Players[iIndex].m_dwAddress + 0x101C ), &Players[iIndex].m_fViewangles, 12, NULL );
  367. ReadProcessMemory( hProcess, (PVOID)( Players[iIndex].m_dwAddress + 0x29C ) , &Players[iIndex].m_vecOrigin, 12, NULL );
  368. ReadProcessMemory( hProcess, (PVOID)( Players[iIndex].m_dwAddress + 0x2B4 ) , &Players[iIndex].m_fFlags, 4, NULL );
  369. ReadProcessMemory( hProcess, (PVOID)( Players[iIndex].m_dwAddress + 0x90 ) , &Players[iIndex].m_iTeamNum, 4, NULL );
  370. ReadProcessMemory( hProcess, (PVOID)( Players[iIndex].m_dwAddress + 0x0DA4 ) , &Players[iIndex].m_iHealth, 4, NULL );
  371. ReadProcessMemory( hProcess, (PVOID)( Players[iIndex].m_dwAddress + 0x87 ) , &Players[iIndex].m_lifeState, 4, NULL );
  372.  
  373. if( !Players[iIndex].m_iTeamNum || /*Players[iIndex].m_iHealth < 0 || Players[iIndex].m_iHealth > 100 ||*/ Players[iIndex].m_lifeState || !Players[iIndex].m_vecOrigin[0] && !Players[iIndex].m_vecOrigin[1] && !Players[iIndex].m_vecOrigin[2] )
  374. continue;
  375.  
  376. if( Players[iIndex].m_iTeamNum == 2 )
  377. Players[iIndex].m_clrTeamColor = RGB( 255, 0, 0 );
  378. else if( Players[iIndex].m_iTeamNum == 3 )
  379. Players[iIndex].m_clrTeamColor = RGB( 0, 0, 255 );
  380. else
  381. Players[iIndex].m_clrTeamColor = RGB( 255, 255, 255 );
  382.  
  383. if( Players[iIndex].m_fFlags &FL_DUCKING )
  384. Players[iIndex].m_vecOrigin[2] -= 35;
  385. else
  386. Players[iIndex].m_vecOrigin[2] -= 25;
  387. if( CalculateScreen( Players[iIndex].m_vecOrigin, gLocalPlayer.GetAbsOrigin(), gLocalPlayer.GetViewAngles(), gLocalPlayer.GetFOV(), 25, Players[iIndex].m_f2DCoordinates ) )
  388. {
  389. sprintf( szHealthEsp, \"- %u -\", Players[iIndex].m_iHealth );
  390. DrawString( GameWindow.hDC, Players[iIndex].m_f2DCoordinates[0], Players[iIndex].m_f2DCoordinates[1] + 12, GetRValue(Players[iIndex].m_clrTeamColor), GetGValue(Players[iIndex].m_clrTeamColor), GetBValue(Players[iIndex].m_clrTeamColor), szHealthEsp, true );
  391. DrawBox( GameWindow.hDC, Players[iIndex].m_f2DCoordinates[0], Players[iIndex].m_f2DCoordinates[1], GetRValue(Players[iIndex].m_clrTeamColor), GetGValue(Players[iIndex].m_clrTeamColor), GetBValue(Players[iIndex].m_clrTeamColor), 24, 2 );
  392. }
  393. if( Players[iIndex].m_fFlags &FL_DUCKING )
  394. Players[iIndex].m_vecOrigin[2] += 35;
  395. else
  396. Players[iIndex].m_vecOrigin[2] += 25;
  397.  
  398. AngleVectors( Players[iIndex].m_fViewangles, fForward, fRight, fUp );
  399. Players[iIndex].m_vecOrigin[0] += fForward[0] * 8;
  400. Players[iIndex].m_vecOrigin[1] += fForward[1] * 8;
  401. Players[iIndex].m_vecOrigin[2] += fForward[2] * 8;
  402. Players[iIndex].m_vecOrigin[0] += fRight[0] * 2;
  403. Players[iIndex].m_vecOrigin[1] += fRight[1] * 2;
  404. Players[iIndex].m_vecOrigin[2] += fRight[2] * 2;
  405. if( CalculateScreen( Players[iIndex].m_vecOrigin, gLocalPlayer.GetAbsOrigin(), gLocalPlayer.GetViewAngles(), gLocalPlayer.GetFOV(), 4, Players[iIndex].m_f2DCoordinates ) )
  406. {
  407. DrawBox( GameWindow.hDC, Players[iIndex].m_f2DCoordinates[0], Players[iIndex].m_f2DCoordinates[1], 0, 255, 0, 2, 2 );
  408. }
  409. }
  410. }
  411. }
  412. }
  413.  
  414. //credits to xgx
  415. void DrawBox(HDC context, int x, int y, int r, int g, int b, int size, int thickness)
  416. {
  417. HBRUSH handle_brush;
  418. LOGBRUSH log_brush;
  419.  
  420. log_brush.lbStyle = BS_NULL;
  421.  
  422. handle_brush = CreateBrushIndirect( &log_brush );
  423. SelectObject( context, handle_brush );
  424.  
  425. HPEN pen;
  426. pen = CreatePen( PS_SOLID, thickness, RGB( r, g, b ) );
  427. SelectObject( context, pen );
  428.  
  429. Rectangle( context, x - size/2, y - size/2, x + size/2, y + size/2 );
  430.  
  431. DeleteObject( pen );
  432. }
  433.  
  434. void DrawString(HDC context, int x, int y, int r, int g, int b, char* text, bool center)
  435. {
  436. HFONT font;
  437. font = CreateFont(
  438. 14, // height of font
  439. 0, // average character width
  440. 0, // angle of escapement
  441. 0, // base-line orientation angle
  442. /*FW_MEDIUM*/800, // font weight
  443. 0, // italic attribute option
  444. 0, // underline attribute option
  445. 0, // strikeout attribute option
  446. ANSI_CHARSET, // character set identifier
  447. OUT_OUTLINE_PRECIS, // output precision
  448. CLIP_STROKE_PRECIS, // clipping precision
  449. ANTIALIASED_QUALITY, // output quality
  450. VARIABLE_PITCH|FF_SWISS, // pitch and family
  451. \"Arial\" // typeface name
  452. );
  453.  
  454.  
  455. if(center)
  456. {
  457. SetTextAlign(context,TA_CENTER|TA_NOUPDATECP);
  458. }
  459.  
  460. SetBkColor(context,RGB(0,0,0));
  461. SetBkMode(context,TRANSPARENT);
  462.  
  463. SetTextColor(context,RGB(r,g,b));
  464.  
  465. SelectObject(context,font);
  466.  
  467. TextOutA(context,x,y,text,strlen(text));
  468.  
  469. DeleteObject(font);
  470. }
  471.  
  472.  
  473. return 0;
  474. }
  475.  


__________________

________________________________________________________

Coding Status: Fortgeschritten