Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.74 KB | None | 0 0
  1. //Posted by kh9_lb, a member of the community in the CronusMAX Forums - https://cronusmax.com/forums
  2.  
  3. //Posted : Tuesday 20th of August, 2019 4:00 UTC
  4.  
  5. // GPC Online Library// antirecoil_complete_(vertical_+_horizontal)_and_rapidfire,_both_adjustable_on_the_fly,_with_on/off_and_save_function.gpc
  6.  
  7.  
  8. //-------------------------------------------------------------------------------------------
  9. // ANTIRECOIL and RAPIDFIRE (both adjustable on the fly, with ON/OFF and SAVE function)
  10. //-------------------------------------------------------------------------------------------
  11. // Version: 6.1 - Classic
  12. // Platform: Multi
  13. // Controller: Multi
  14. // Game: All FPS games
  15. // Author: LEX LOST
  16. //------------------------------------------------------------------------------------------
  17.  
  18.  
  19. // LED indications:
  20.  
  21.  
  22. // Green: rapidfire ON - antirecoil ON
  23. // Fuchsia: antirecoil ON - rapidfire OFF
  24. // Blue: rapidfire ON - antirecoil OFF
  25. // Red: rapidfire OFF - antirecoil OFF;
  26.  
  27.  
  28. //-------------------------------------------------------------------------------------------
  29.  
  30.  
  31. // XBOX INSTRUCTIONS:
  32.  
  33.  
  34. // RAPIDFIRE (ON by default - Start value: 13 - GREEN led = ON; RED led = OFF)
  35. // Hold LT and Press Y to Enable or Disable Rapidfire (with rumble notify)
  36. // Hold A and tap UP to increase Rate of Fire (+1 each tap on UP, while holding A)
  37. // Hold A and tap DOWN to decrease Rate of Fire (-1 each tap on DOWN, while holding A)
  38.  
  39.  
  40. // ANTIRECOIL (ON by default - Start value: vertical = 30; Horizontal = 0)
  41. // Hold LT and Press X to Enable or Disable Antirecoil (with rumble notify)
  42. // Hold LT and tap UP to increase Antirecoil (+1 each tap on UP, while holding LT)
  43. // Hold LT and tap DOWN to decrease Antirecoil (-1 each tap on DOWN, while holding LT)
  44. // Hold LT and tap RIGHT to compensate to the right (+1 each tap on RIGHT , while holding LT)
  45. // Hold LT and tap LEFT to compensate to the left (+1 each tap on LEFT, while holding LT)
  46.  
  47.  
  48. // SAVE new values into the CronusMax eeprom: Hold LT and press MENU (or START, for XBOX360 users)
  49.  
  50. //-------------------------------------------------------------------------------------------
  51. // PLAYSTATION INSTRUCTIONS:
  52.  
  53.  
  54. // RAPIDFIRE (ON by default - Start value: 13 - GREEN led = ON; RED led = OFF)
  55. // Hold L2 and Press TRIANGLE to Enable or Disable Rapidfire (with rumble notify)
  56. // Hold CROSS and tap UP to increase Rate of Fire (+1 each tap on UP, while holding CROSS)
  57. // Hold CROSS and tap DOWN to decrease Rate of Fire (-1 each tap on DOWN, while holding CROSS)
  58.  
  59.  
  60. // ANTIRECOIL (ON by default - Start value: vertical = 30; Horizontal = 0)
  61. // Hold L2 and Press SQUARE to Enable or Disable Antirecoil (with rumble notify)
  62. // Hold L2 and tap UP to increase Antirecoil (+1 each tap on UP, while holding L2)
  63. // Hold L2 and tap DOWN to decrease Antirecoil (-1 each tap on DOWN, while holding L2)
  64. // Hold L2 and tap RIGHT to compensate to the right(+1 each tap on RIGHT , while holding L2)
  65. // Hold L2 and tap LEFT to compensate to the left (+1 each tap on LEFT, while holding L2)
  66.  
  67.  
  68. // Save new values into the CronusMax eeprom: Hold L2 and press OPTIONS (or START, for PS3 users)
  69.  
  70.  
  71. //-------------------------------------------------------------------------------------------
  72.  
  73.  
  74. //DECLARARATIONS - define
  75.  
  76.  
  77. define RF_switch = 17; // XB1_Y - PS4_TRIANGLE
  78. define AR_switch = 20; // XB1_X - PS4_SQUARE
  79. //-------------------------------------------------------------------------------------------
  80. define save = 2; // XB1_MENU - PS4_OPTIONS
  81. //-------------------------------------------------------------------------------------------
  82. define AR_Release = 70; // change this value to set when antirecoil stops working (min: antirecoil value + 10)
  83. define Scope_only = TRUE; // if TRUE Antirecoil IS ON only when scoping - if FALSE, is always ON
  84. //-------------------------------------------------------------------------------------------
  85. define UP = 13;
  86. define DOWN = 14;
  87. define LEFT = 15;
  88. define RIGHT = 16;
  89. //-------------------------------------------------------------------------------------------
  90. define Blue = 1;
  91. define Red = 2;
  92. define Green = 3;
  93. define Pink = 4;
  94. define SkyBlue = 5;
  95. define Yellow = 6;
  96. define White = 7;
  97. //-------------------------------------------------------------------------------------------
  98. data(1,
  99. 2,0,0,0, //1. Blue
  100. 0,2,0,0, //2. Red
  101. 0,0,2,0, //3. Lime/Green
  102. 0,0,0,2, //4. Fuchsia/Pink
  103. 2,0,2,0, //5. SkyBlue
  104. 0,2,2,0, //6. Yellow
  105. 2,2,2,2 //7. White
  106. );
  107. //-------------------------------------------------------------------------------------------
  108.  
  109.  
  110. //VARIABLES - int
  111.  
  112.  
  113. int recoil_onoff = TRUE; // if TRUE Antirecoil is ON by default - if FALSE, OFF by default
  114. int rapid_onoff = FALSE; // if TRUE Rapidfire is ON by default - if FALSE, OFF by default
  115. define SWAP_BUMPERS = TRUE;
  116. int RATE_OF_FIRE = 13; // Range: 1 to 25 RPS (Round/s)
  117. int ANTI_RECOIL = 50;
  118. int ANTI_RECOIL_H = 4;
  119. int anti_recoil;
  120. int anti_recoil_H;
  121. int Col_ind;
  122. int fire_button;
  123. int scope_button;
  124. int hold_time;
  125. int rest_time;
  126.  
  127.  
  128. //-------------------------------------------------------------------------------------------
  129.  
  130.  
  131. //INITIALIZATION - init
  132.  
  133.  
  134. init{
  135.  
  136.  
  137. if(get_console() == PIO_PS3) {
  138. fire_button = 3;
  139. scope_button = 6;
  140. }else {
  141. fire_button = 4;
  142. scope_button = 7;
  143. }
  144.  
  145.  
  146. RATE_OF_FIRE = get_pvar(SPVAR_1, 0, 25, 13);
  147. ANTI_RECOIL = get_pvar(SPVAR_2, -100,+100, 50);
  148. ANTI_RECOIL_H = get_pvar(SPVAR_3, -100,+100, 4);
  149. }
  150.  
  151.  
  152. //-------------------------------------------------------------------------------------------
  153.  
  154.  
  155. //MAIN BLOCK ROUTINES
  156.  
  157.  
  158. main {
  159. if (SWAP_BUMPERS) {
  160. swap(3, 4); swap (6, 7);
  161. }
  162.  
  163. if(get_val(7) && event_press(AR_switch)) {
  164. combo_run (vibrate);
  165. recoil_onoff=!recoil_onoff;
  166. }
  167.  
  168.  
  169. if(get_val(7) && event_press(RF_switch)) {
  170. combo_run (vibrate);
  171. rapid_onoff=!rapid_onoff;
  172. }
  173.  
  174.  
  175. if((rapid_onoff) && recoil_onoff) colourled(Green);
  176. if((rapid_onoff) && !recoil_onoff) colourled(Blue);
  177. if((recoil_onoff) && !rapid_onoff) colourled(Pink);
  178. if((!recoil_onoff) && !rapid_onoff) colourled(Red);
  179.  
  180. if(rapid_onoff) { if(get_val(4)) {
  181. combo_run (RAPID_FIRE);
  182. }
  183. }
  184. hold_time = 500 / RATE_OF_FIRE;
  185. rest_time = hold_time - 20;
  186. if(rest_time < 0) rest_time = 0;
  187.  
  188. if(get_val(19)) {
  189. if(event_press(UP)) {
  190. RATE_OF_FIRE = RATE_OF_FIRE+ 1;
  191. }
  192. if(event_press(DOWN)) {
  193. RATE_OF_FIRE = RATE_OF_FIRE- 1;
  194. }
  195. set_val(UP,0); set_val(DOWN,0);
  196. }
  197.  
  198. if(get_val(scope_button) && event_press(save)){
  199. combo_run(vibrate);
  200. set_pvar(SPVAR_1, RATE_OF_FIRE);
  201. set_pvar(SPVAR_2, ANTI_RECOIL);
  202. set_pvar(SPVAR_3, ANTI_RECOIL_H);
  203. set_val(save, 0);
  204. }
  205. if(get_val(7)){
  206. if(event_press(UP)){
  207. ANTI_RECOIL = ANTI_RECOIL+ 1;
  208. }
  209. if(event_press(DOWN)) {
  210. ANTI_RECOIL = ANTI_RECOIL- 1;
  211. }
  212. set_val(UP,0); set_val(DOWN,0);
  213.  
  214. if(event_press(LEFT)){
  215. ANTI_RECOIL_H = ANTI_RECOIL_H+ 1;
  216. }
  217. if(event_press(RIGHT)) {
  218. ANTI_RECOIL_H = ANTI_RECOIL_H- 1;
  219. }
  220. set_val(LEFT,0); set_val(RIGHT,0);
  221.  
  222.  
  223. }
  224. if(!Scope_only || get_val(scope_button) && get_val(fire_button )) {
  225. combo_run(AntiRecoil);
  226. }
  227.  
  228.  
  229. if( abs(get_val(10)) > AR_Release || abs(get_val(9)) > AR_Release) {
  230. combo_stop (AntiRecoil);
  231. }
  232. }
  233. //-------------------------------------------------------------------------------------------
  234.  
  235.  
  236. //COMBO BLOCKS
  237.  
  238.  
  239. combo vibrate {
  240. set_rumble(RUMBLE_A, 100);
  241. wait(300);
  242. reset_rumble();
  243. }
  244.  
  245.  
  246. combo RAPID_FIRE {
  247. set_val(fire_button, 100);
  248. wait(hold_time);
  249. set_val(fire_button, 0);
  250. wait(rest_time);
  251. set_val(fire_button, 0);
  252. }
  253.  
  254.  
  255. combo AntiRecoil { // This combo must be the last one
  256. if(recoil_onoff) {
  257. anti_recoil = get_val(10) + ANTI_RECOIL;
  258. if(anti_recoil > 100) anti_recoil = 100;
  259. set_val(10, anti_recoil);
  260. anti_recoil_H = get_val(9) + ANTI_RECOIL_H;
  261. if(anti_recoil_H > 100) anti_recoil_H = 100;
  262. set_val(9, anti_recoil_H);
  263. }
  264. }
  265. // COLOR LED function
  266. //--------------------------------------------------------------
  267. function colourled(Colour) {
  268. Col_ind=(Colour*4)- 3;
  269. set_led(LED_1,dbyte(Col_ind ));
  270. set_led(LED_2,dbyte(Col_ind+ 1));
  271. set_led(LED_3,dbyte(Col_ind+ 2));
  272. set_led(LED_4,dbyte(Col_ind+ 3)); }// End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement