0

所以基本上,这就是我的脚本目前的样子,它是一个快速射击宏并减少了枪支的后坐力,但是由于某种原因我永远无法使用这个脚本进行喷涂,因为它非常慢,因为我猜它正在减少后坐力。我想知道我是否可以在没有任何后坐力的情况下射击 4、5 发子弹(仅在按住鼠标 3 时自动射击,而不是在轻敲时。)并在已经按住鼠标 3 的同时继续像普通喷雾一样喷射而没有任何延迟。所以 4 发子弹没有后坐力,并在同一个周期内进行常规喷雾。如果那有意义的话。任何帮助将不胜感激。

EnablePrimaryMouseButtonEvents(true);

function OnEvent(event, arg) 
    if IsKeyLockOn("scrolllock")then
        if IsMouseButtonPressed(3) then
            repeat  
                if IsMouseButtonPressed(3) then
                    repeat
                        PressMouseButton(1)
                        Sleep(15)
                        ReleaseMouseButton(1)
                    until not IsMouseButtonPressed(3)
                end             
            until not IsMouseButtonPressed(3)
        end   
    end
end

4

1 回答 1

0
local rapid_fire_delay = 15   -- delay between simulation of LMB press/release
local LMB_Pressed
do  -- initializing PRNG
   local dt = 0
   for c in GetDate():gmatch"." do
      dt = (dt % 65537 * 23456 + c:byte())
   end
   math.randomseed(dt)
end

function OnEvent(event, arg)
   if event == "MOUSE_BUTTON_PRESSED" and arg == 2 and IsKeyLockOn("scrolllock") then   -- RMB press
      for j = 1, math.random(4, 5) do  -- first 4-5 bullets as rapid-fire
         PressMouseButton(1)
         Sleep(math.random(rapid_fire_delay, 2*rapid_fire_delay))
         ReleaseMouseButton(1)
         Sleep(math.random(rapid_fire_delay, 2*rapid_fire_delay))
         if not IsMouseButtonPressed(3) then return end  -- is RMB pressed?
      end
      PressMouseButton(1)
      LMB_Pressed = true
   elseif event == "MOUSE_BUTTON_RELEASED" and arg == 2 and LMB_Pressed then   -- RMB release
      ReleaseMouseButton(1)
      LMB_Pressed = false
   elseif event == "MOUSE_BUTTON_PRESSED" and arg == 5 then 
      repeat 
         Sleep(15) 
         PressKey("SPACEBAR") 
         Sleep(15) 
         ReleaseKey("SPACEBAR") 
      until not IsMouseButtonPressed(5) 
   end 
end

这条线的for j = 1, math.random(4, 5) do意思是“从 4 到 5 个子弹的随机数量”。
如果你想要正好 3 个项目符号将此行更改为for j = 1, 3 do


编辑:

这是关于如何使快速射击只有在LMB双击后才能打开的说明。
通常缓慢的 LMB 点击不会触发快速射击。

local Prev_LMB_Time, LMB_Pressed = 0
function OnEvent(event, arg)
   if event == "MOUSE_BUTTON_PRESSED" and arg == 1 then
      if IsKeyLockOn("scrolllock") then
         local tm = GetRunningTime()
         tm, Prev_LMB_Time = tm - Prev_LMB_Time, tm
         if tm < 200 then  -- LMB double-click
            for j = 1, 100 do
               PressMouseButton(1)
               Sleep(1)
               ReleaseMouseButton(1)
               Sleep(1)
               if not IsMouseButtonPressed(4) then return end
            end
         end
      end
      PressMouseButton(1)
      LMB_Pressed = true
   elseif event == "MOUSE_BUTTON_RELEASED" and arg == 1 and LMB_Pressed then
      ReleaseMouseButton(1)
      LMB_Pressed = false
   elseif event == "MOUSE_BUTTON_PRESSED" and arg == 5 then
      repeat
         Sleep(15)
         PressKey("SPACEBAR")
         Sleep(15)
         ReleaseKey("SPACEBAR")
      until not IsMouseButtonPressed(5)
   end
end

目前你在 GHUB:

Primary Click = G1
Back          = G4 G8

您应该在 GHUB 中做什么(按此顺序):

  1. 将“Primary Click”绑定到 G8(从现在开始,使用 button#8 代替 LMB)
  2. 将“返回”绑定到 G1
  3. 设置脚本
Now you should have the following:
Primary Click = G8
Back          = G1 G4

鼠标按钮#8 现在是“备用 LMB”,以防 LMB 工作不正常。

于 2020-07-05T04:36:41.970 回答