Advertisement
Guest User

Untitled

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