Advertisement
Bagura32rus

Cronus_NEW

Jul 25th, 2019
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. //Posted by , a member of the community in the CronusMAX Forums - https://cronusmax.com/forums
  2.  
  3. //Posted : Friday 2nd of August, 2019 16:50 UTC
  4.  
  5.  
  6. int sn = 13; // Change deadzone value
  7. int ar = 12; // Change anti-recoil value
  8. int RecoilDelay = 20; // delay in ms
  9. int RY = 22;
  10. int RX = 21;
  11. int modifiedRY;
  12. int trueRY;
  13. int trueRX;
  14. int altradius;
  15. int finalRX;
  16. int finalRY;
  17.  
  18.  
  19. main {
  20. if (get_val(4) && get_val(7) && get_ptime(4) >= RecoilDelay) {
  21. AntiRecoil(ar);
  22. }
  23. }
  24.  
  25.  
  26. function AntiRecoil (recoil) {
  27. trueRY = isqrt(pow(RY, 2) + pow(RX, 2) - sn) / isqrt(pow(RY, 2) + pow(RX, 2) * RY);
  28. trueRX = isqrt(pow(RY, 2) + pow(RX, 2) - sn) / isqrt(pow(RY, 2) + pow(RX, 2) * RX);
  29. if (RY > 0) {
  30. modifiedRY = (100 - sn - recoil) / (100 - sn) * trueRY + recoil;
  31. }
  32. if (RY < 0) {
  33. modifiedRY = (100 - sn + recoil) / (100 - sn) * trueRY + recoil;
  34. }
  35. altradius = isqrt(pow(trueRX, 2) + pow(modifiedRY, 2));
  36. finalRX = trueRX * (altradius + sn) / altradius;
  37. finalRY = modifiedRY * (altradius + sn) / altradius;
  38. if (pow(RX, 2) + pow(RY, 2) <= pow(sn, 2)) {
  39. set_val(RY, (sn + recoil));
  40. }
  41. if (pow(RX, 2) + pow(RY, 2) > pow(sn, 2)) {
  42. if (finalRY > 100) {
  43. set_val(RY, 100);
  44. }
  45. if (finalRY < -100) {
  46. set_val(RY, -100);
  47. }
  48. if (finalRX > 100) {
  49. set_val(RX, 100);
  50. }
  51. if (finalRX < -100) {
  52. set_val(RX, -100);
  53. }
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement