Advertisement
Bagura32rus

T2_(Мой игровой)

Aug 11th, 2019
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.66 KB | None | 0 0
  1. #include <xb1.gph>
  2.  
  3. #define float fix32
  4.  
  5. // Rapidfire values
  6. #define RF_HOLD 40
  7. #define RF_RELEASE 90
  8.  
  9. //Anti Recoil value
  10. #define AR 27.00
  11. uint16 ARecoilDelay = 115;
  12. float MinARecoilPercent = 30.0;
  13. float StickNoise = 6.32;
  14.  
  15. bool rapidfire;
  16.  
  17. init {
  18. led(255,0,0);
  19. }
  20.  
  21. main {
  22. // ADS + DPAD UP to toggle rapidfire
  23. if (is_active(7) && event_active(9)) {
  24. rapidfire = !rapidfire;
  25. if(rapidfire) led(0,255,0);
  26. else led(255,0,0);
  27. }
  28.  
  29. if (get_actual(BUTTON_8) &&get_actual(BUTTON_5) && time_active(BUTTON_5) >= ARecoilDelay){
  30. if (abs(get_actual(STICK_1_X)) < StickNoise) set_val(STICK_1_X, 0.0);
  31. if (abs(get_actual(STICK_1_Y)) < StickNoise) set_val(STICK_1_Y, 0.0);
  32. if (abs(get_actual(STICK_2_X)) < StickNoise) set_val(STICK_2_X, 0.0);
  33. if (abs(get_actual(STICK_2_Y)) < StickNoise) set_val(STICK_2_Y, 0.0);
  34.  
  35. AntiRecoil(STICK_1_Y, AR);
  36. }
  37.  
  38. if(get_actual(4) && rapidfire) combo_run(RapidFire);
  39.  
  40. if(is_active(XB1_B))set_val(XB1_B, time_active(XB1_B) < 41 ? 100 : 0);
  41. else set_val(XB1_B, time_release(XB1_B) < 41 ? 100 : 0);
  42.  
  43. if(is_active(XB1_UP) && is_active(XB1_DOWN)) {
  44. set_val(XB1_UP, 0); set_val(XB1_DOWN, 0);
  45. if(event_active(XB1_UP)) combo_run(prone);
  46. }
  47. }
  48.  
  49. combo RapidFire {
  50. set_val(4, 100);
  51. wait(RF_HOLD);
  52. set_val(4, 0);
  53. wait(RF_RELEASE);
  54. }
  55.  
  56. combo prone {
  57. set_val(XB1_B, 100);
  58. wait(300);
  59. }
  60.  
  61. void led(int8 r, int8 g, int8 b) {
  62. led_set(LED_1, (fix32)b, 0);
  63. led_set(LED_2, (fix32)r, 0);
  64. led_set(LED_3, (fix32)g, 0);
  65. return;
  66. }
  67.  
  68. void AntiRecoil(uint8 AxisToApply, float ARecoilToApply) {
  69. float CurrentX = get_val(STICK_1_X);
  70. float CurrentY = get_val(STICK_1_Y);
  71. float MinARecoilFactor = MinARecoilPercent / 100.0;
  72. float MinARecoilToApply = MinARecoilFactor * ARecoilToApply;
  73. //This sets the ARecoil to be dependent on both X and Y axis movement. With more emphasis on Y
  74. float MovementARecoilToApply = (1.0 - MinARecoilFactor) * ((ARecoilToApply * (100.0 - sqrt(CurrentX*CurrentX + CurrentY*CurrentY))) / (100.0 + abs(CurrentX) + (CurrentY*CurrentY*0.5)));
  75. set_val(AxisToApply,clamp(MinARecoilToApply + MovementARecoilToApply + get_val(AxisToApply),-100.00,100.00 - MinARecoilToApply));
  76. }
  77. bool run_flag;
  78.  
  79. main
  80. {
  81. if(!get_actual(BUTTON_5) && !get_actual(BUTTON_8) && !run_flag &&
  82. get_val(STICK_2_Y) < -99.0 && time_active(STICK_2_Y) > 300) {
  83. run_flag = 1;
  84. combo_run(run);
  85. }else if(get_val(STICK_2_Y) > -99.0 && event_release(STICK_2_Y)) {
  86. run_flag = 0;
  87. }
  88. }
  89.  
  90. combo run
  91. {
  92. set_val(BUTTON_9, 0.0);
  93. wait(200);
  94. set_val(BUTTON_9, 100.0);
  95. wait(400);
  96. set_val(BUTTON_9, 0.0);
  97. }
  98. bool toggle;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement