Advertisement
Bagura32rus

T2_Rapid+Автобег

Aug 1st, 2019
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. #define sn 7.0 // Change deadzone value
  2. #define ar 16.0 // Change anti-recoil value
  3. #define RecoilDelay 20 // delay in ms
  4. #define float fix32
  5.  
  6. // Rapidfire values
  7. #define RF_HOLD 40
  8. #define RF_RELEASE 90
  9. #define RY get_actual(22)
  10. #define RX get_actual(21)
  11. bool rapidfire;
  12.  
  13. init {
  14. led(255,0,0);
  15. }
  16. main {
  17. if (get_actual(4) && is_active(7) && time_active(4) >= RecoilDelay) AntiRecoil(ar);
  18. }
  19.  
  20. void AntiRecoil (fix32 recoil) {
  21. if (abs(get_actual(STICK_1_X)) < sn) set_val(STICK_1_X, 0.0);
  22. if (abs(get_actual(STICK_1_Y)) < sn) set_val(STICK_1_Y, 0.0);
  23. fix32 modifiedRY;
  24.  
  25. fix32 trueRY = (sqrt(RY*RY+RX*RX)-sn)/sqrt(RY*RY+RX*RX)*RY;
  26. fix32 trueRX = (sqrt(RY*RY+RX*RX)-sn)/sqrt(RY*RY+RX*RX)*RX;
  27.  
  28. if (RY > 0.0) modifiedRY = (100.0-sn-recoil)/(100.0-sn)*trueRY + recoil;
  29. if (RY < 0.0) modifiedRY = (100.0-sn+recoil)/(100.0-sn)*trueRY + recoil;
  30.  
  31. fix32 altradius = sqrt(trueRX*trueRX + modifiedRY*modifiedRY);
  32.  
  33. fix32 finalRX = trueRX * (altradius + sn)/altradius;
  34. fix32 finalRY = modifiedRY * (altradius + sn)/altradius;
  35.  
  36. if (RX*RX+RY*RY <= sn*sn) set_val(22,(sn+recoil));
  37.  
  38. if (RX*RX+RY*RY > sn*sn) {
  39. set_val(22,clamp(finalRY, -100f, 100f));
  40. set_val(21,clamp(finalRX, -100f, 100f));
  41. }
  42. }
  43. bool run_flag;
  44.  
  45. main
  46. {
  47.  
  48. }
  49.  
  50. combo run
  51. {
  52. set_val(BUTTON_9, 0.0);
  53. wait(200);
  54. set_val(BUTTON_9, 100.0);
  55. wait(400);
  56. set_val(BUTTON_9, 0.0);
  57. }
  58. bool toggle;
  59.  
  60. main {
  61. // ADS + DPAD UP to toggle rapidfire
  62. if (is_active(7) && event_active(9)) {
  63. rapidfire = !rapidfire;
  64. if(rapidfire) led(0,255,0);
  65. else led(255,0,0);
  66. }
  67.  
  68. if(get_actual(4) && rapidfire) combo_run(RapidFire);
  69.  
  70. }
  71.  
  72. combo RapidFire {
  73. set_val(4, 100);
  74. wait(RF_HOLD);
  75. set_val(4, 0);
  76. wait(RF_RELEASE);
  77. }
  78. void led(int8 r, int8 g, int8 b) {
  79. led_set(LED_1, (fix32)b, 0);
  80. led_set(LED_2, (fix32)r, 0);
  81. led_set(LED_3, (fix32)g, 0);
  82. return;
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement