Advertisement
Guest User

Untitled

a guest
Feb 21st, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.92 KB | None | 0 0
  1. #include "Resolver.h"
  2. #include "Player.h"
  3. #include "Misc.h"
  4. int NextRes[64], OldHit[64], ResolverNew[64], Miss[64];
  5.  
  6. Resolver_ Resolver;
  7. void Resolver_::LBYResolver(Vector3* &Angel, CPlayer* Ent) {
  8. if (!Ent)
  9. return;
  10. if (!Angel)
  11. return;
  12. Angel->y = Ent->GetLowerBody();
  13. }
  14.  
  15. void Resolver_::LBYFixResolver(Vector3* &Angel, CPlayer* Ent) {
  16. if (!Ent)
  17. return;
  18. if (!Angel)
  19. return;
  20. float LBY = Ent->GetLowerBody();
  21. static float OldLBY, delta;
  22. if (LBY != OldLBY)
  23. {
  24. Angel->y = OldLBY;
  25. OldLBY = LBY;
  26. }
  27. }
  28.  
  29. bool bullettime() {
  30. CPlayer* Loc = Interfaces.EntList->GetClientEntity<CPlayer>(Interfaces.Engine->GetLocalPlayer());
  31. if (!Loc)
  32. return 0;
  33. CBaseWeapon* Weapon = Loc->GetWeap();
  34. if (!Weapon)
  35. return false;
  36. float flServerTime = Hack.Misc->GetServerTime();
  37. float flNextPrimaryAttack = Weapon->NextPrimaryAttack();
  38.  
  39. bool BulletTime = true;
  40.  
  41. if (flNextPrimaryAttack > flServerTime)
  42. BulletTime = false;
  43.  
  44. return BulletTime;
  45.  
  46. }
  47.  
  48. void Resolver_::ShotsCounter() {
  49. static bool bulletcounter = 0;
  50. if (true) {
  51. bool bulletfired = bullettime();
  52. static bool firsttick = true;
  53. if (!bulletfired) {
  54. if (firsttick) {
  55. Shots++;
  56. firsttick = false;
  57.  
  58. }
  59. bulletcounter++;
  60. if (bulletcounter > 20) {
  61. bulletcounter = 0;
  62. firsttick = true;
  63. }
  64. }
  65. else {
  66. firsttick = true;
  67. bulletcounter = 0;
  68. }
  69. }
  70. }
  71.  
  72. void Resolver_::AddaptiveResolverT2(Vector3* &Angle, CPlayer* Ent)
  73. {
  74. if (!Angle)
  75. return;
  76. if (!Ent)
  77. return;
  78. ShotsCounter();
  79. int Testdata = 2;
  80. float LowerBody = Ent->GetLowerBody();
  81. static float OldLBY, delta;
  82. if (LowerBody != OldLBY)
  83. {
  84. delta = OldLBY - LowerBody;
  85. OldLBY = LowerBody;
  86. }
  87. if (Ent->GetVelocity().Length2D() > 30 && Ent->GetFlags() & FL_ONGROUND)
  88. Angle->y = LowerBody;
  89. else
  90. {
  91. if (Settings.PList.ItsLBYAA[Ent->GetIndex()])
  92. Angle->y = LowerBody + delta;
  93. else if (Settings.PList.ItsShuffle[Ent->GetIndex()])
  94. Angle->y = LowerBody + 180;
  95. else {
  96. if (NextRes[Ent->GetIndex()] <= Shots)
  97. {
  98. NextRes[Ent->GetIndex()] = Shots + 1;
  99. if (OldHit[Ent->GetIndex()] == Hit)
  100. Miss[Ent->GetIndex()]++;
  101. OldHit[Ent->GetIndex()] = Hit;
  102. }
  103. if (Miss[Ent->GetIndex()] >= Testdata) {
  104. ResolverNew[Ent->GetIndex()]++;
  105. Miss[Ent->GetIndex()] = 0;
  106. }
  107.  
  108. switch (ResolverNew[Ent->GetIndex()] % 4)
  109. {
  110. case 0: {
  111. Angle->y = LowerBody;
  112. }
  113. break;
  114. case 1: {
  115. Angle->y = LowerBody + delta;
  116. if (NextRes[Ent->GetIndex()] < Shots)
  117. Settings.PList.ItsLBYAA[Ent->GetIndex()] = true;
  118. }
  119. break;
  120. case 2: {
  121. Angle->y = LowerBody + 180;
  122. if (NextRes[Ent->GetIndex()] < Shots)
  123. Settings.PList.ItsShuffle[Ent->GetIndex()] = true;
  124. }
  125. break;
  126. case 3:
  127. Angle->y = OldLBY;
  128. break;
  129. }
  130. }
  131. }
  132. }
  133. void Resolver_::Resolver() {
  134. CPlayer* Loc = Interfaces.EntList->GetClientEntity<CPlayer>(Interfaces.Engine->GetLocalPlayer());
  135. if (Loc && Loc->GetHealth() > 0) {
  136. CPlayer* Ent;
  137. int ResolverType = Settings.GuzGuiMenu.RageTab.ResolverType.returnvalue;
  138. for (int i = 0; i < Interfaces.Engine->GetMaxClients(); i++) {
  139. Ent = Interfaces.EntList->GetClientEntity<CPlayer>(i);
  140. if (!Ent)
  141. continue;
  142.  
  143. if (Ent->IsDormant()
  144. || (Ent->GetHealth() == 0)
  145. || !Ent->IsAlive()
  146. || (Ent == Loc)
  147. || (Ent->GetTeam() == Loc->GetTeam())
  148. || Ent->HasGunGameImmunity())
  149. continue;
  150. Vector3* Angls = Ent->GetEyeAnglesPointer();
  151. if(!Angls)
  152. continue;
  153. float OrirAngleY = Ent->GetEyeAngles().y;
  154. if (Settings.PList.XFix[i].returnvalue > 0)
  155. {
  156. switch (Settings.PList.XFix[i].returnvalue)
  157. {
  158. case 1:
  159. Angls->x = -89;
  160. break;
  161. case 2:
  162. Angls->x = 89;
  163. break;
  164. case 3:
  165. Angls->x = Settings.PList.CustomXFix[i];
  166. break;
  167. }
  168. }
  169. if (Settings.PList.YFix[i].returnvalue > 0)
  170. {
  171. switch (Settings.PList.YFix[i].returnvalue)
  172. {
  173. case 1:
  174. Angls->y = OrirAngleY + 180;
  175. break;
  176. case 2:
  177. LBYResolver(Angls, Ent);
  178. break;
  179. case 3:
  180. LBYFixResolver(Angls, Ent);
  181. break;
  182. case 4:
  183. Angls->y = Settings.PList.CustomYFix[i];
  184. break;
  185. }
  186. }
  187. if (Settings.PList.YFix[i].returnvalue == 0)
  188. {
  189. switch (ResolverType) {
  190. case 0:
  191. //Пуста
  192. break;
  193. case 1:
  194. LBYResolver(Angls, Ent);
  195. break;
  196. case 2:
  197. LBYFixResolver(Angls, Ent);
  198. break;
  199. case 3:
  200. AddaptiveResolverT2(Angls, Ent);
  201. break;
  202. }
  203. }
  204. }
  205. }
  206. }
  207.  
  208. void Resolver_::ResolverFunc(ClientFrameStage_t curStage) {
  209. if (!Hack.Local)
  210. return;
  211. if (!Hack.Weapon)
  212. return;
  213. if (!Hack.Local->IsValid())
  214. return;
  215. if (curStage == FRAME_NET_UPDATE_POSTDATAUPDATE_START)
  216. Resolver();
  217. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement