Advertisement
Guest User

Untitled

a guest
Jul 19th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 14.46 KB | None | 0 0
  1. --------------------------------------------------------------------------
  2. ----------------        Basic Variable       -----------------------------
  3. ----------------         Do not edit                 ---------------------
  4. --------------------------------------------------------------------------
  5. local current_weapon = "none"
  6.  
  7. --------------------------------------------------------------------------
  8. ----------------        Basic Setting       ------------------------------
  9. --------------------------------------------------------------------------
  10.  
  11. ---- key bind ----
  12.  
  13. local ump9_key = nil
  14. local akm_key = 7
  15. local m16a4_key = 8
  16. local m416_key = 4
  17. local scarl_key = 5
  18. local uzi_key = nil
  19. local set_off_key = 9
  20.  
  21. ---- keyboard ---- Only Support logitech G Keyboard
  22.  
  23. local ump9_gkey = nil  ---1 is use F1.
  24. local akm_gkey = nil
  25. local m16a4_gkey = nil
  26. local m416_gkey = nil
  27. local scarl_gkey = nil
  28. local uzi_gkey = nil
  29. local set_off_gkey = nil
  30.  
  31. ---- fire key ----
  32.  
  33. local fire_key = "F8"
  34.  
  35. ---- can use "lalt", "ralt", "alt"  "lshift", "rshift", "shift"  "lctrl", "rctrl", "ctrl"
  36.  
  37. local ignore_key = "lalt" --- ignore key
  38. local hold_breath_key = "lshift"
  39.  
  40. ---- only can use "numlock", "capslock", "scrolllock"
  41.  
  42. local full_mode_key = "numlock"   ---numlock lamp on,recoil is full_mode.
  43. local mode_switch_key = "capslock"
  44. local lighton_key = "scrolllock"  ---start script,scrolllock lamp will be on.close script ,scrolllock lamp will be off.
  45.  
  46. --- fastloot setting---
  47. --- Press fast_loot_key and click Left mouse button ---
  48.  
  49. local fastloot = false ---if you don't need it, you can close it by true to false.
  50. local fast_loot_key = "lctrl"
  51. local move = 40 ----1920*1080
  52.  
  53. --- Your Sensitivity in Game
  54.  
  55. local vertical_sensitivity = 1.0 --- default is 0.7
  56. local target_sensitivity = 39 --- default is 50.0
  57. local scope_sensitivity = 38 --- default is 50.0
  58. local scope4x_sensitivity = 36 --- default is 50.0
  59.  
  60. ---- function ----
  61. -- if auto_mode = true ,the guns need to switch automatic shooting mode,except m16 single.
  62.  
  63. local auto_mode = true
  64.  
  65. -- you can close these by true to false
  66.  
  67. local hold_breath_mode = true
  68. local full_mode = true
  69.  
  70. ---- Obfs setting
  71. ---- Two firing time intervals = weapon_speed * interval_ratio * ( 1 + random_seed * ( 0 ~ 1))
  72. local weapon_speed_mode = false
  73. -- local obfs_mode = false
  74. local obfs_mode = false
  75. local interval_ratio = 0.75
  76. local random_seed = 1
  77.  
  78. --------------------------------------------------------------------------
  79. ----------------        Recoil Table        ------------------------------
  80. ---------------- You can fix the value here ------------------------------
  81. --------------------------------------------------------------------------
  82. --- recoil times
  83. --- if the Recoil compensation is Large or small,You can modify the value of all_recoil_Times or recoil_table{times}
  84. local all_recoil_times = 1
  85.  
  86. local recoil_table = {}
  87.  
  88. recoil_table["ump9"] = {
  89.     basic={28,30,30,30,37,30,31,36,37,37,37,40,40,39,39,41,41,42,44,42,43,40,41,44,40,40,41,42,43},
  90.     basictimes = 0.963,
  91.    
  92.     full={28,30,30,30,37,30,31,36,37,37,37,40,40,39,39,41,41,42,44,42,43,40,41,44,40,40,41,42,43},
  93.     fulltimes = 0.963*0.75,
  94.    
  95.     holdbreathtimes = 1.25,
  96.    
  97.     quadruple={28,30,30,30,37,30,31,36,37,37,37,40,40,39,39,41,41,42,44,42,43,40,41,44,40,40,41,42,43},
  98.     quadrupletimes = 4*0.963,
  99.    
  100.     fullof4x={28,30,30,30,37,30,31,36,37,37,37,40,40,39,39,41,41,42,44,42,43,40,41,44,40,40,41,42,43},
  101.     fullof4xtimes = 4*0.963*0.75,
  102.    
  103.     speed = 90,
  104. }
  105.  
  106. recoil_table["akm"] = {
  107.     basic={56,40,38,44,48,55,56,61,65,65,67,68,67,71,74,70,65,66,72,74,72,71,70,70,70,72,74,76,72},
  108.     basictimes = 0.96,
  109.    
  110.     full={56,40,38,44,48,55,56,61,65,65,67,68,67,71,74,70,65,66,72,74,72,71,70,70,70,72,74,76,72},
  111.     fulltimes = 0.96*0.75,
  112.    
  113.     holdbreathtimes = 1.25,
  114.    
  115.     quadruple={56,40,38,44,48,55,56,61,65,65,67,68,67,71,74,70,65,66,72,74,72,71,70,70,70,72,74,76,72},
  116.     quadrupletimes = 4*0.96*0.99,
  117.    
  118.     fullof4x={56,40,38,44,48,55,56,61,65,65,67,68,67,71,74,70,65,66,72,74,72,71,70,70,70,72,74,76,72},
  119.     fullof4xtimes = 4*0.96*0.99*0.75,
  120.    
  121.     speed = 100,
  122. }
  123.  
  124.  
  125. recoil_table["m16a4"] = {
  126.     basic={47,35,38,44,58,61,70,67,73,74,72,69,72,71,72,70,72,70,69,71},
  127.     basictimes = 1.15,
  128.        
  129.     full={47,35,38,44,58,61,70,67,73,74,72,69,72,71,72,70,72,70,69,71},
  130.     fulltimes = 1.15*0.75,
  131.    
  132.     holdbreathtimes = 1.25,
  133.    
  134.     quadruple={47,35,38,44,58,61,70,67,73,74,72,69,72,71,72,70,72,70,69,71},
  135.     quadrupletimes = 1.15*4,
  136.    
  137.     fullof4x={47,35,38,44,58,61,70,67,73,74,72,69,72,71,72,70,72,70,69,71},
  138.     fullof4xtimes = 4*1.15*0.75,
  139.  
  140.     speed = 80,
  141. }
  142.  
  143. recoil_table["m416"] = {
  144.     basic={49,37,38,39,43,46,47,47,48,49,50,49,55,56,58,60},
  145.     basictimes = 1.05,
  146.    
  147.     full={49,37,38,39,43,46,47,47,48,49,50,49,55,56,58,60},
  148.     fulltimes = 1.05*0.75,
  149.    
  150.     holdbreathtimes = 1.25,
  151.    
  152.     quadruple={49,37,38,39,43,46,47,47,48,49,50,49,55,56,58,60},
  153.     quadrupletimes = 4*1.05,
  154.    
  155.     fullof4x={49,37,38,39,43,46,47,47,48,49,50,49,55,56,58,60},
  156.     fullof4xtimes = 4*1.05*0.75,
  157.    
  158.     speed = 90,
  159. }
  160.  
  161. recoil_table["scarl"] = {
  162.     basic={44,28,32,40,44, 45,48,48,46,53, 54,56,58,57,56, 62},
  163.     basictimes = 0.89,
  164.  
  165.     full={44,28,32,40,44, 45,48,48,46,53, 54,56,58,57,56, 62},
  166.     fulltimes = 0.89*0.75,
  167.    
  168.     holdbreathtimes = 1.25,
  169.    
  170.     quadruple={44,28,32,40,44, 45,48,48,46,53, 54,56,58,57,56, 62},
  171.     quadrupletimes = 4*0.89,
  172.    
  173.     fullof4x={44,28,32,40,44, 45,48,48,46,53, 54,56,58,57,56, 62},
  174.     fullof4xtimes = 4*0.89*0.75,
  175.    
  176.     speed = 100,
  177. }
  178.  
  179. recoil_table["uzi"] = {
  180.     basic={18,18,18,19,19,21,24,24,30,26,30,30,34,34,38},
  181.     basictimes = 1.7,
  182.    
  183.     full={18,18,18,19,19,21,24,24,30,26,30,30,34,34,38},
  184.     fulltimes = 1.7*0.75,
  185.    
  186.     holdbreathtimes = 1.25,
  187.    
  188.     quadruple={18,18,18,19,19,21,24,24,30,26,30,30,34,34,38},
  189.     quadrupletimes = 1.7,
  190.    
  191.     fullof4x={18,18,18,19,19,21,24,24,30,26,30,30,34,34,38},
  192.     fullof4xtimes = 1.7*0.75,
  193.  
  194.     speed = 48,
  195. }
  196.  
  197. recoil_table["none"] = {
  198.     basic={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  199.     basictimes = 1,
  200.    
  201.     full={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  202.     fulltimes = 1,
  203.    
  204.     holdbreathtimes = 1,
  205.    
  206.     quadruple={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  207.     quadrupletimes = 1,
  208.    
  209.     fullof4x={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  210.     fullof4xtimes = 1,
  211.    
  212.     speed = 60,
  213. }
  214.  
  215.  
  216. --------------------------------------------------------------------------
  217. ----------------          Function          ------------------------------
  218. --------------------------------------------------------------------------
  219.  
  220.  
  221. function convert_sens(unconvertedSens)
  222.     return 0.002 * math.pow(10, unconvertedSens / 50)
  223. end
  224.  
  225. function calc_sens_scale(sensitivity)
  226.     return convert_sens(sensitivity)/convert_sens(50)
  227. end
  228.  
  229. local target_scale = calc_sens_scale(target_sensitivity)
  230. local scope_scale = calc_sens_scale(scope_sensitivity)
  231. local scope4x_scale = calc_sens_scale(scope4x_sensitivity)
  232.  
  233. function recoil_mode()
  234.     if not IsKeyLockOn(mode_switch_key) then
  235.         if IsKeyLockOn(full_mode_key) and full_mode then
  236.            return "full";
  237.            else
  238.            return "basic";
  239.         end
  240.     end
  241.    
  242.     if IsKeyLockOn(mode_switch_key) then
  243.         if IsKeyLockOn(full_mode_key) and full_mode then
  244.            return "fullof4x"
  245.            else
  246.            return "quadruple"
  247.         end
  248.     end    
  249. end
  250.            
  251. function recoil_value(_weapon,_duration)
  252.     local _mode = recoil_mode()
  253.     local step = (math.floor(_duration/100)) + 1
  254.     if step > #recoil_table[_weapon][_mode] then
  255.         step = #recoil_table[_weapon][_mode]
  256.     end
  257.    
  258.     local weapon_recoil = recoil_table[_weapon][_mode][step]
  259.     -- OutputLogMessage("weapon_recoil = %s\n", weapon_recoil)
  260.    
  261.     local weapon_speed = 30
  262.     if weapon_speed_mode then
  263.         weapon_speed = recoil_table[_weapon]["speed"]
  264.     end
  265.     -- OutputLogMessage("weapon_speed = %s\n", weapon_speed)
  266.  
  267.     local weapon_basictimes = recoil_table[_weapon]["basictimes"]
  268.     local weapon_fulltimes = recoil_table[_weapon]["fulltimes"]
  269.     local weapon_quadrupletimes = recoil_table[_weapon]["quadrupletimes"]
  270.     local weapon_fullof4xtimes = recoil_table[_weapon]["fullof4xtimes"]
  271.     local weapon_holdbreathtimes = recoil_table[_weapon]["holdbreathtimes"]
  272.     local weapon_intervals = weapon_speed    
  273.    
  274.     if obfs_mode then
  275.         local coefficient = interval_ratio * ( 1 + random_seed * math.random())
  276.         weapon_intervals = math.floor(coefficient  * weapon_speed)
  277.     end
  278.     -- OutputLogMessage("weapon_intervals = %s\n", weapon_intervals)
  279.  
  280.     recoil_recovery = weapon_recoil * weapon_intervals / 100
  281.     recoil_times = all_recoil_times * 0.7 / vertical_sensitivity
  282.  
  283.     if recoil_mode() == "basic" and not IsModifierPressed(hold_breath_key) then
  284.     recoil_recovery = recoil_recovery * recoil_times * weapon_basictimes
  285.     end
  286.     if recoil_mode() == "basic" and hold_breath_mode and IsModifierPressed(hold_breath_key) then
  287.     recoil_recovery = recoil_recovery * weapon_holdbreathtimes * recoil_times * weapon_basictimes
  288.     end
  289.  
  290.     if recoil_mode() == "full" and not IsModifierPressed(hold_breath_key) then
  291.     recoil_recovery = recoil_recovery * recoil_times * weapon_fulltimes
  292.     end
  293.     if recoil_mode() == "full" and hold_breath_mode and IsModifierPressed(hold_breath_key) then
  294.     recoil_recovery = recoil_recovery * weapon_holdbreathtimes * recoil_times * weapon_fulltimes
  295.     end
  296.  
  297.     if recoil_mode() == "quadruple" then
  298.     recoil_recovery = recoil_recovery * recoil_times * weapon_quadrupletimes
  299.     end
  300.    
  301.     if recoil_mode() == "fullof4x" then
  302.     recoil_recovery = recoil_recovery * recoil_times * weapon_fullof4xtimes
  303.     end
  304.    
  305.     -- issues/3
  306.     if IsMouseButtonPressed(2) then
  307.         recoil_recovery = recoil_recovery / target_scale
  308.     elseif recoil_mode() == "basic" then
  309.         recoil_recovery = recoil_recovery / scope_scale
  310.     elseif recoil_mode() == "full" then
  311.         recoil_recovery = recoil_recovery / scope_scale
  312.     elseif recoil_mode() == "quadruple" then
  313.         recoil_recovery = recoil_recovery / scope4x_scale
  314.     elseif recoil_mode() == "fullof4x" then
  315.         recoil_recovery = recoil_recovery / scope4x_scale
  316.     end
  317.  
  318.     return weapon_intervals,recoil_recovery
  319. end
  320.  
  321.  
  322. --------------------------------------------------------------------------
  323. ----------------          OnEvent          ------------------------------
  324. --------------------------------------------------------------------------
  325.  
  326.  
  327. function OnEvent(event, arg)
  328.     OutputLogMessage("event = %s, arg = %d\n", event, arg)
  329.     if (event == "PROFILE_ACTIVATED") then
  330.         EnablePrimaryMouseButtonEvents(true)
  331.     elseif event == "PROFILE_DEACTIVATED" then
  332.         current_weapon = "none"
  333.         shoot_duration = 0.0
  334.         ReleaseKey(fire_key)
  335.         ReleaseMouseButton(1)
  336.     end
  337.  
  338.     if (event == "MOUSE_BUTTON_PRESSED" and arg == set_off_key)
  339.     or (event == "G_PRESSED" and arg == set_off_gkey) then
  340.         current_weapon = "none"
  341.     elseif (event == "MOUSE_BUTTON_PRESSED" and arg == akm_key)
  342.     or (event == "G_PRESSED" and arg == akm_gkey) then
  343.         current_weapon = "akm"
  344.     elseif (event == "MOUSE_BUTTON_PRESSED" and arg == m16a4_key)
  345.     or (event == "G_PRESSED" and arg == m16a4_gkey) then
  346.         current_weapon = "m16a4"
  347.     elseif (event == "MOUSE_BUTTON_PRESSED" and arg == m416_key)
  348.     or (event == "G_PRESSED" and arg == m416_gkey) then
  349.         current_weapon = "m416"
  350.     elseif (event == "MOUSE_BUTTON_PRESSED" and arg == ump9_key)
  351.     or (event == "G_PRESSED" and arg == ump9_gkey) then
  352.         current_weapon = "ump9"
  353.     elseif (event == "MOUSE_BUTTON_PRESSED" and arg == uzi_key)
  354.     or (event == "G_PRESSED" and arg == uzi_gkey) then
  355.         current_weapon = "uzi"
  356.     elseif (event == "MOUSE_BUTTON_PRESSED" and arg == scarl_key)
  357.     or (event == "G_PRESSED" and arg == scarl_gkey) then
  358.         current_weapon = "scarl"
  359.     elseif (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and not IsModifierPressed(fast_loot_key)) then
  360.         -- button 1 : Shoot
  361.         if ((current_weapon == "none") or IsModifierPressed(ignore_key)) then
  362.             PressKey(fire_key)
  363.             repeat
  364.                 Sleep(30)
  365.             until not IsMouseButtonPressed(1)
  366.             ReleaseKey(fire_key)
  367.         elseif((current_weapon == "m16a4") and not IsModifierPressed(ignore_key)) then
  368.             local shoot_duration = 0.0
  369.             repeat
  370.                 local intervals,recovery = recoil_value(current_weapon,shoot_duration)
  371.                 PressAndReleaseKey(fire_key)
  372.                 MoveMouseRelative(0, recovery )
  373.                 Sleep(intervals)
  374.                 shoot_duration = shoot_duration + intervals
  375.             until not IsMouseButtonPressed(1)
  376.         else
  377.             if auto_mode then
  378.                 PressKey(fire_key)
  379.                 local shoot_duration = 0.0
  380.                 repeat
  381.                 local intervals,recovery = recoil_value(current_weapon,shoot_duration)
  382.                 MoveMouseRelative(0, recovery )
  383.                 Sleep(intervals)
  384.                 shoot_duration = shoot_duration + intervals
  385.                 until not IsMouseButtonPressed(1)
  386.             else
  387.                 local shoot_duration = 0.0
  388.                 repeat
  389.                 local intervals,recovery = recoil_value(current_weapon,shoot_duration)
  390.                 PressAndReleaseKey(fire_key)
  391.                 MoveMouseRelative(0, recovery )
  392.                 Sleep(intervals)
  393.                 shoot_duration = shoot_duration + intervals
  394.                 until not IsMouseButtonPressed(1)
  395.             end
  396.         end
  397.     elseif (event == "MOUSE_BUTTON_RELEASED" and arg == 1) then
  398.         ReleaseKey(fire_key)
  399.     end
  400.     while (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and IsModifierPressed(fast_loot_key) and fastloot) do
  401.         ReleaseMouseButton(1)
  402.         PressMouseButton(1)
  403.         for i = 0, 14 do
  404.         MoveMouseRelative(move, 0)
  405.         Sleep(2)
  406.         end
  407.         ReleaseMouseButton(1)
  408.         for i = 0, 14 do
  409.         MoveMouseRelative(-move, 0)
  410.         Sleep(2)
  411.         end
  412.         Sleep(10)
  413.     end
  414.     if (current_weapon == "none") then
  415.         if IsKeyLockOn(lighton_key) then
  416.         PressAndReleaseKey(lighton_key)
  417.         end
  418.     else
  419.         if not IsKeyLockOn(lighton_key) then
  420.         PressAndReleaseKey(lighton_key)
  421.         end
  422.     end
  423. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement