Advertisement
Guest User

Untitled

a guest
May 28th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.59 KB | None | 0 0
  1. #pragma once
  2. #include "../../stdafx.h"
  3. #include "../Utils/Hitbox.h"
  4. #include "../Menu/Menu.h"
  5. #include "../Utils/Playerlist.h"
  6. #include "../Menu/SettingsManager.h"
  7. #include "../Utils/HitboxLists.h"
  8.  
  9. class GOTV
  10. {
  11. public:
  12. class CHLTVFrame;
  13.  
  14. class CHLTVDemoRecorder
  15. {
  16. public:
  17. char _pad[0x540];
  18. bool m_bIsRecording;
  19. int m_nFrameCount;
  20. float m_nStartTick;
  21. int m_SequenceInfo;
  22. int m_nDeltaTick;
  23. int m_nSignonTick;
  24. bf_write m_MessageData; // temp buffer for all network messages
  25. };
  26.  
  27. class CHLTVServer
  28. {
  29. public:
  30. char _pad[0x5040];
  31. CHLTVDemoRecorder m_DemoRecorder;
  32. };
  33. };
  34.  
  35. class Aimbot
  36. {
  37. private:
  38. struct Target_t
  39. {
  40. Vector aimspot;
  41. CBaseEntity* ent;
  42. };
  43.  
  44. Vector GetBestPoint( PlayerList::CPlayer* Player )
  45. {
  46. for( auto Pos : Player->ShootPos )
  47. {
  48. if( Pos != Vector( 0, 0, 0 ) )
  49. {
  50. Vector New = Pos + Player->box->points[ 1 ];
  51. Vector Aimangles;
  52. Misc::CalcAngle( Hacks.LocalPlayer->GetEyePosition(), New, Aimangles );
  53. //if (Misc::FovTo(Hacks.CurrentCmd->viewangles, Aimangles) > Menu::AimbotMenu::Selection::Fov.value) continue;
  54. float damage = Autowall::GetDamage( New );
  55. if( damage > Settings.GetSetting( Tab_Ragebot, Ragebot_MinDamage ) )
  56. {
  57. return New;
  58. }
  59. }
  60. }
  61. return Vector( 0, 0, 0 );
  62. }
  63.  
  64. void HitboxScanning( PlayerList::CPlayer* Player )
  65. {
  66. Hitbox* box = Player->box;
  67. CTraceFilter filter;
  68. trace_t tr;
  69. Ray_t ray;
  70. int Dividens[3] = { ( box->points[ 8 ].x - box->points[ 1 ].x ) / 5 , ( box->points[ 8 ].y - box->points[ 1 ].y ) / 5, ( box->points[ 8 ].z - box->points[ 1 ].z ) / 5 };
  71. int Old = Player->ScannedNumber + 5;
  72. for( ; Player->ScannedNumber < Old; Player->ScannedNumber++ )
  73. {
  74. int x = Player->ScannedNumber;
  75. int y = 0;
  76. int z = 0;
  77. while( x >= 5 )
  78. {
  79. x -= 5;
  80. y++;
  81. }
  82. while( y >= 5 )
  83. {
  84. y -= 5;
  85. z++;
  86. }
  87. if( z >= 5 )
  88. {
  89. Player->ScannedNumber = 0;
  90. break;
  91. }
  92.  
  93. Vector Pos = Vector( box->points[ 1 ].x + ( x * Dividens[ 0 ] ), box->points[ 1 ].y + ( y * Dividens[ 1 ] ), box->points[ 1 ].z + ( z * Dividens[ 2 ] ) );
  94. ray.Init( Pos, Pos );
  95. Interfaces.pTrace->TraceRay( ray, MASK_SHOT, &filter, &tr );
  96. if( tr.m_pEnt != Player->entity )
  97. Player->ShootPos[ Player->ScannedNumber ] = Vector( 0, 0, 0 );
  98. }
  99. }
  100.  
  101. void GetTargets( std::vector< CBaseEntity* >& possibletargets )
  102. {
  103. for( auto i = 0; i <= Interfaces.pEntList->GetHighestEntityIndex(); i++ )
  104. {
  105. auto pEntity = static_cast< CBaseEntity* >( Interfaces.pEntList->GetClientEntity( i ) );
  106. if( pEntity == nullptr )
  107. continue;
  108. if( pEntity == Hacks.LocalPlayer )
  109. continue;
  110. if( !pEntity->isAlive() )
  111. continue;
  112. if( !( pEntity->GetHealth() > 0 ) )
  113. continue;
  114. if( pEntity->GetTeam() == Hacks.LocalPlayer->GetTeam() )
  115. continue;
  116. if( pEntity->IsDormant() )
  117. continue;
  118. PlayerList::CPlayer* Player = plist.FindPlayer( pEntity );
  119. Player->entity = pEntity;
  120. if( pEntity->HasGunGameImmunity() )
  121. continue;
  122. player_info_t info;
  123. if( !( Interfaces.pEngine->GetPlayerInfo( pEntity->GetIndex(), &info ) ) )
  124. continue;
  125. possibletargets.emplace_back( pEntity );
  126. }
  127. }
  128.  
  129. void GetAimSpots( std::vector< Vector >& Targets, std::vector< Target_t >& possibleaimspots, std::vector< CBaseEntity* >& possibletargets )
  130. {
  131. if( ( int )possibletargets.size() )
  132. {
  133. for( CBaseEntity* pEntity : possibletargets )
  134. {
  135. Targets.emplace_back( pEntity->GetVecOrigin() - Hacks.LocalPlayer->GetVecOrigin() );
  136.  
  137. std::vector< int > iArray = { iBoxListDefault[ ( int )Settings.GetSetting( Tab_Ragebot, Ragebot_Hitbox ) ] };
  138.  
  139. float flBestDamage = 0.f;
  140.  
  141. if( Settings.GetMenuSetting( Tab_Ragebot, Ragebot_Velocity ) )
  142. {
  143. if ( !( pEntity->GetFlags() & FL_ONGROUND ) )
  144. {
  145. iArray = { ( int )CSGOHitboxID::Pelvis };
  146. flBestDamage = ScanBoxList( pEntity, iArray, possibleaimspots );
  147. if( flBestDamage == 0 )
  148. {
  149. if( ( Settings.GetSetting( Tab_Ragebot, Ragebot_PreferBodyAim ) == 2 && pEntity->GetEyeAngles().x > 60 ) || Settings.GetSetting( Tab_Ragebot, Ragebot_PreferBodyAim ) == 3 )
  150. {
  151. if( Settings.GetSetting( Tab_Ragebot, Ragebot_Multibox ) == 2 )
  152. iArray = iBoxListSmartBaim;
  153. else
  154. iArray = iBoxListBaim;
  155. }
  156. else
  157. {
  158. int iSwitch = Settings.GetSetting( Tab_Ragebot, Ragebot_Multibox );
  159. int i;
  160. switch( iSwitch )
  161. {
  162. case 0:
  163. case 1:
  164. iArray = { iBoxListDefault[ ( int )Settings.GetSetting( Tab_Ragebot, Ragebot_Hitbox ) ] };
  165. break;
  166. case 2:
  167. iArray = iBoxListSmart;
  168. break;
  169. case 3:
  170. iArray = iBoxListMax;
  171. break;
  172. }
  173. }
  174. flBestDamage = ScanBoxList( pEntity, iArray, possibleaimspots );
  175. }
  176. }
  177. else if( pEntity->GetFlags() & FL_ONGROUND && pEntity->GetVecVelocity().Length2D() < 1.f )
  178. {
  179. iArray = iBoxListSmartBaim;
  180. flBestDamage = ScanBoxList( pEntity, iArray, possibleaimspots );
  181. if( flBestDamage == 0 )
  182. {
  183. if( ( Settings.GetSetting( Tab_Ragebot, Ragebot_PreferBodyAim ) == 2 && pEntity->GetEyeAngles().x > 60 ) || Settings.GetSetting( Tab_Ragebot, Ragebot_PreferBodyAim ) == 3 )
  184. {
  185. if( Settings.GetSetting( Tab_Ragebot, Ragebot_Multibox ) == 2 )
  186. iArray = iBoxListSmartBaim;
  187. else
  188. iArray = iBoxListBaim;
  189. }
  190. else
  191. {
  192. int iSwitch = Settings.GetSetting( Tab_Ragebot, Ragebot_Multibox );
  193. int i;
  194. switch( iSwitch )
  195. {
  196. case 0:
  197. case 1:
  198. iArray = { iBoxListDefault[ ( int )Settings.GetSetting( Tab_Ragebot, Ragebot_Hitbox ) ] };
  199. break;
  200. case 2:
  201. iArray = iBoxListSmart;
  202. break;
  203. case 3:
  204. iArray = iBoxListMax;
  205. break;
  206. }
  207. }
  208. flBestDamage = ScanBoxList( pEntity, iArray, possibleaimspots );
  209. }
  210. }
  211. else
  212. {
  213. if( ( Settings.GetSetting( Tab_Ragebot, Ragebot_PreferBodyAim ) == 2 && pEntity->GetEyeAngles().x > 60 ) || Settings.GetSetting( Tab_Ragebot, Ragebot_PreferBodyAim ) == 3 )
  214. {
  215. if( Settings.GetSetting( Tab_Ragebot, Ragebot_Multibox ) == 2 )
  216. iArray = iBoxListSmartBaim;
  217. else
  218. iArray = iBoxListBaim;
  219. }
  220. else
  221. {
  222. int iSwitch = Settings.GetSetting( Tab_Ragebot, Ragebot_Multibox );
  223. int i;
  224. switch( iSwitch )
  225. {
  226. case 0:
  227. case 1:
  228. iArray = { iBoxListDefault[ ( int )Settings.GetSetting( Tab_Ragebot, Ragebot_Hitbox ) ] };
  229. break;
  230. case 2:
  231. iArray = iBoxListSmart;
  232. break;
  233. case 3:
  234. iArray = iBoxListMax;
  235. break;
  236. }
  237. }
  238. flBestDamage = ScanBoxList( pEntity, iArray, possibleaimspots );
  239. }
  240. }
  241. else
  242. {
  243. if( ( Settings.GetSetting( Tab_Ragebot, Ragebot_PreferBodyAim ) == 2 && pEntity->GetEyeAngles().x > 60 ) || Settings.GetSetting( Tab_Ragebot, Ragebot_PreferBodyAim ) == 3 )
  244. iArray = iBoxListBaim;
  245. else
  246. {
  247. int iSwitch = Settings.GetSetting( Tab_Ragebot, Ragebot_Multibox );
  248. int i;
  249. switch( iSwitch )
  250. {
  251. case 0:
  252. case 1:
  253. iArray = { iBoxListDefault[ ( int )Settings.GetSetting( Tab_Ragebot, Ragebot_Hitbox ) ] };
  254. break;
  255. case 2:
  256. iArray = iBoxListSmart;
  257. break;
  258. case 3:
  259. iArray = iBoxListMax;
  260. break;
  261. }
  262. }
  263. flBestDamage = ScanBoxList( pEntity, iArray, possibleaimspots );
  264. }
  265.  
  266. if( flBestDamage == 0 )
  267. {
  268. iArray = iBoxListSafety;
  269. ScanBoxList( pEntity, iArray, possibleaimspots );
  270. }
  271. }
  272. }
  273. }
  274.  
  275. float ScanBoxList( CBaseEntity* pEntity, std::vector< int > iArray, std::vector< Target_t > &possibleaimspots )
  276. {
  277. float flBestDamage = 0.f;
  278.  
  279. if( iArray.size() > 0 )
  280. {
  281. for( int i = 0; i < iArray.size(); i++ )
  282. {
  283. Hitbox box;
  284. if( !box.GetHitbox( pEntity, iArray[ i ] ) )
  285. continue;
  286.  
  287. Vector Aimspot;
  288. float flDamage = iArray[ i ] == ( int )CSGOHitboxID::Head ? box.GetBestPoint( Aimspot ) : box.ScanCenter( Aimspot );
  289.  
  290. if( flDamage > Settings.GetMenuSetting( Tab_Ragebot, Ragebot_MinDamage ) || ( flDamage > pEntity->GetHealth() && Settings.GetMenuSetting( Tab_Ragebot, Ragebot_AcceptKill ) ) )
  291. {
  292. if( flDamage > flBestDamage )
  293. {
  294. flBestDamage = flDamage;
  295. if( Misc::GetNumberOfTicksChoked( pEntity ) > 5 && Settings.GetSetting( Tab_Ragebot, Ragebot_PositionAdjustment ) )
  296. {
  297. Aimspot -= pEntity->GetAbsOrigin();
  298. Aimspot += pEntity->GetNetworkOrigin();
  299. }
  300. Target_t target;
  301. target.aimspot = Aimspot;
  302. target.ent = pEntity;
  303. possibleaimspots.emplace_back( target );
  304.  
  305. }
  306. }
  307. }
  308. }
  309.  
  310. return flBestDamage;
  311. }
  312.  
  313. void GetAtTargetsSpot( std::vector< Vector >& Targets )
  314. {
  315. if( ! ( int )Targets.size() )
  316. Target = Vector( 0, 0, 0 );
  317. else
  318. {
  319. Target = Vector( 8128, 8128, 8128 );
  320. for( Vector t : Targets )
  321. {
  322. if( t.Length() < Target.Length() )
  323. Target = t;
  324. }
  325. }
  326. }
  327.  
  328. bool Fire( CInput::CUserCmd* cmd, Vector vecCurPos, std::vector< Target_t >& possibleaimspots )
  329. {
  330. int closest = 8129;
  331. if( ( !Settings.GetSetting( Tab_Ragebot, Ragebot_AutoShoot ) && !( cmd->buttons & IN_ATTACK ) ) || !Settings.GetSetting( Tab_Ragebot, Ragebot_AimbotEnabled ) )
  332. return true;
  333. Vector Aimangles;
  334. int originaltick = Hacks.CurrentCmd->tick_count;
  335. int distance = -1;
  336. static int Cycle = 0;
  337. bool shot = false;
  338. if( !Misc::bullettime() )
  339. return true;
  340. int selection = Settings.GetSetting( Tab_Ragebot, Ragebot_Selection );
  341. if( selection != 2 )
  342. for( int i = 0; i < possibleaimspots.size(); i++ )
  343. {
  344. Target_t Aimspot = possibleaimspots[ i ];
  345. Misc::CalcAngle( vecCurPos, Aimspot.aimspot, Aimangles );
  346. distance = vecCurPos.DistTo( Aimspot.aimspot );
  347. if( distance < closest )
  348. {
  349. int TempTick = originaltick;
  350. if( Misc::GetNumberOfTicksChoked( Aimspot.ent ) > 5 && Settings.GetSetting( Tab_Ragebot, Ragebot_PositionAdjustment ) )
  351. {
  352. float correct = Interfaces.pEngine->GetNetChannelInfo()->GetLatency( FLOW_OUTGOING );
  353. TempTick = originaltick + Misc::GetNumberOfTicksChoked( Aimspot.ent ) + Misc::TIME_TO_TICKS( fabs( correct ) );
  354. }
  355. if( AntiGOTV( TempTick ) )
  356. {
  357. Hacks.CurrentCmd->tick_count = TempTick;
  358. cmd->viewangles = Aimangles;
  359. pTarget = Aimspot.ent;
  360. cmd->buttons |= IN_ATTACK;
  361. Angles = cmd->viewangles;
  362. shot = true;
  363. }
  364. }
  365. }
  366. else if( possibleaimspots.size() > 0 )
  367. {
  368. Cycle++;
  369. if( Cycle >= possibleaimspots.size() )
  370. Cycle = 0;
  371. Target_t Aimspot = possibleaimspots[ Cycle ];
  372. Misc::CalcAngle( vecCurPos, Aimspot.aimspot, Aimangles );
  373. int TempTick = originaltick;
  374. if( Misc::GetNumberOfTicksChoked( Aimspot.ent ) > 5 && Settings.GetSetting( Tab_Ragebot, Ragebot_PositionAdjustment ) )
  375. {
  376. float correct = Interfaces.pEngine->GetNetChannelInfo()->GetLatency( FLOW_OUTGOING );
  377. TempTick = originaltick + Misc::GetNumberOfTicksChoked( Aimspot.ent ) + Misc::TIME_TO_TICKS( fabs( correct ) );
  378. }
  379. if( AntiGOTV( TempTick ) )
  380. {
  381. Hacks.CurrentCmd->tick_count = TempTick;
  382. cmd->viewangles = Aimangles;
  383. Angles = cmd->viewangles;
  384. cmd->buttons |= IN_ATTACK;
  385. shot = true;
  386. }
  387. }
  388. return false;
  389. }
  390.  
  391. bool AntiGOTV( int tick )
  392. {
  393. static bool wasactivegotv = false;
  394. if( Settings.GetSetting( Tab_Ragebot, Ragebot_GOTV ) )
  395. {
  396. static DWORD dwHLTVServer;
  397. static GOTV::CHLTVServer** hltv;
  398. if( !hltv || !*hltv )
  399. {
  400. dwHLTVServer = Utils.PatternSearch( "engine.dll", ( PBYTE )"\xBE\x00\x00\x00\x00\x8B\x0E\x85\xC9\x74\x1E\xD4\x89\x02\x8B\x01", "x????xxxxxx", NULL, NULL ) + 0x1;
  401. hltv = *( GOTV::CHLTVServer*** )dwHLTVServer;
  402. }
  403.  
  404. if( hltv && *hltv )
  405. {
  406. int Dif = max(( *hltv )->m_DemoRecorder.m_nDeltaTick, tick) - min(( *hltv )->m_DemoRecorder.m_nDeltaTick, tick);
  407. if( Dif % 16 == 0 || Dif == 0 )
  408. {
  409. return false;
  410. }
  411. }
  412. }
  413. return true;
  414. }
  415.  
  416. public:
  417. Vector Target;
  418. CBaseEntity* pTarget;
  419. Vector Angles;
  420.  
  421. bool Aim( CInput::CUserCmd* cmd )
  422. {
  423. Angles = cmd->viewangles;
  424. Vector vecCurPos = Hacks.LocalPlayer->GetEyePosition();
  425. std::vector< Vector > Targets;
  426. std::vector< Target_t > possibleaimspots;
  427. std::vector< CBaseEntity* > possibletargets;
  428. GetTargets( possibletargets );
  429. GetAimSpots( Targets, possibleaimspots, possibletargets );
  430. GetAtTargetsSpot( Targets );
  431. if( Hacks.LocalWeapon->IsMiscWeapon() )
  432. return false;
  433. if( Settings.GetSetting( Tab_Ragebot, Ragebot_Autoscope ) && Hacks.LocalWeapon->isSniper() && !Hacks.LocalPlayer->m_bIsScoped() && possibleaimspots.size() > 0 )
  434. {
  435. Hacks.CurrentCmd->buttons |= IN_ATTACK2;
  436. return false;
  437. }
  438. if( Hacks.LocalWeapon->hitchance() < Settings.GetSetting( Tab_Ragebot, Ragebot_Hitchance ) )
  439. return false;
  440. return !Fire( cmd, vecCurPos, possibleaimspots );
  441. }
  442. } Aimbot;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement