0

无法让这个工作。第一部分是切换功能(鼠标按钮 8),它通过按下和释放鼠标按钮 1 来发挥作用。第二部分(鼠标按钮 7)只是一个“点击使用”功能。

第一部分

local enabled = false

function IsLeftNotPressed()
    return not IsMouseButtonPressed(1)
end

function OnEvent(event, arg)
    if (event == "PROFILE_ACTIVATED") then
        OutputLogMessage("PROFILE_ACTIVATED")
        EnablePrimaryMouseButtonEvents(true)
        return
    elseif event == "PROFILE_DEACTIVATED" then
        OutputLogMessage("PROFILE_DEACTIVATED")
        ReleaseMouseButton(1) -- to prevent it from being stuck on
        return
    end
    if (event == "MOUSE_BUTTON_PRESSED" and arg == 8) then
        enabled = not enabled
    end
    if (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and enabled) then
        repeat
            --Sleep(2)
            MoveMouseRelative(-3, 4)
            if (IsLeftNotPressed()) then return end
                      Sleep(16)
                      MoveMouseRelative(-3, 4)
            if (IsLeftNotPressed()) then return end
                      Sleep(17)
                      MoveMouseRelative(-3, 4)
            if (IsLeftNotPressed()) then return end
                      Sleep(17)
                      MoveMouseRelative(-3, 4)
            if (IsLeftNotPressed()) then return end
                      Sleep(17)
                      MoveMouseRelative(0, 0)
  
        until (IsLeftNotPressed())
    end
end

另一种武器的秒部分

local enabled = false

function IsLeftNotPressed()
    return not IsMouseButtonPressed(1)
end

function OnEvent(event, arg)
    if (event == "PROFILE_ACTIVATED") then
        OutputLogMessage("PROFILE_ACTIVATED")
        EnablePrimaryMouseButtonEvents(true)
        return
    elseif event == "PROFILE_DEACTIVATED" then
        OutputLogMessage("PROFILE_DEACTIVATED")
        ReleaseMouseButton(1) -- to prevent it from being stuck on
        return
    end
    if (event == "MOUSE_BUTTON_PRESSED" and arg == 7) then
        enabled = not enabled
    end
    if (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and enabled) then
        repeat
            if (IsLeftNotPressed()) then return end
                      Sleep(92)
                      MoveMouseRelative(-2, 1)
            if (IsLeftNotPressed()) then return end
                      Sleep(7)
                      MoveMouseRelative(-2, 1)
            if (IsLeftNotPressed()) then return end
                      Sleep(6)
                      MoveMouseRelative(-2, 0)
            if (IsLeftNotPressed()) then return end
                      Sleep(8)
                      MoveMouseRelative(-2, 0)
            if (IsLeftNotPressed()) then return end
                      Sleep(6)
                      MoveMouseRelative(-1, 0)
            if (IsLeftNotPressed()) then return end
                      Sleep(8)
                      MoveMouseRelative(-1, 0)
                      MoveMouseRelative(0, 0)
        until (IsLeftNotPressed())
    end
end

最后一件武器的第三部分

local enabled = false

function IsLeftNotPressed()
    return not IsMouseButtonPressed(1)
end

function OnEvent(event, arg)
    if (event == "PROFILE_ACTIVATED") then
        OutputLogMessage("PROFILE_ACTIVATED")
        EnablePrimaryMouseButtonEvents(true)
        return
    elseif event == "PROFILE_DEACTIVATED" then
        OutputLogMessage("PROFILE_DEACTIVATED")
        ReleaseMouseButton(1) -- to prevent it from being stuck on
        return
    end
    if (event == "MOUSE_BUTTON_PRESSED" and arg == 6) then
        enabled = not enabled
    end
    if (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and enabled) then
        repeat
                if (IsLeftNotPressed()) then return end
                Sleep(5)
                MoveMouseRelative(-1, 0)
                if (IsLeftNotPressed()) then return end
                Sleep(5)
                MoveMouseRelative(-2, -1)
                if (IsLeftNotPressed()) then return end
                Sleep(85)
                MoveMouseRelative(-1, 0)
                if (IsLeftNotPressed()) then return end
                Sleep(5)
                MoveMouseRelative(-1, 0)
                if (IsLeftNotPressed()) then return end
                Sleep(5)
                MoveMouseRelative(-1, 0)
                if (IsLeftNotPressed()) then return end
                Sleep(5)
                MoveMouseRelative(-1, 0)
                if (IsLeftNotPressed()) then return end
                Sleep(80)
                MoveMouseRelative(-1, 0)
                if (IsLeftNotPressed()) then return end
                MoveMouseRelative(0, 0)
        until (IsLeftNotPressed())
    end
end

先感谢您。

4

1 回答 1

0
local recoil_mode  -- possible values: false, 8, 7, 6
local recoil_loops = {
   [8] = {
      {x=-3, y=4, delay=16},
      {x=-3, y=4, delay=17},
      {x=-3, y=4, delay=17},
      {x=-3, y=4, delay=17},
   },
   [7] = {
      {x=-2, y=1, delay=92},
      {x=-2, y=1, delay=7},
      {x=-2, y=0, delay=6},
      {x=-2, y=0, delay=8},
      {x=-1, y=0, delay=6},
      {x=-1, y=0, delay=8},
   },
   [6] = {
      {x=-1, y=0,  delay=5},
      {x=-2, y=-1, delay=5},
      {x=-1, y=0,  delay=85},
      {x=-1, y=0,  delay=5},
      {x=-1, y=0,  delay=5},
      {x=-1, y=0,  delay=5},
      {x=-1, y=0,  delay=80},
   },
}

function OnEvent(event, arg)
   if event == "PROFILE_ACTIVATED" then
      OutputLogMessage("PROFILE_ACTIVATED")
      EnablePrimaryMouseButtonEvents(true)
   elseif event == "PROFILE_DEACTIVATED" then
      OutputLogMessage("PROFILE_DEACTIVATED")
      ReleaseMouseButton(1) -- to prevent it from being stuck on
   elseif event == "MOUSE_BUTTON_PRESSED" and recoil_loops[arg] then
      recoil_mode = recoil_mode ~= arg and arg
      OutputLogMessage("Recoil mode is now "..tostring(recoil_mode))
   elseif event == "MOUSE_BUTTON_PRESSED" and arg == 1 and recoil_mode then
      local loop = recoil_loops[recoil_mode]
      local j = 0
      repeat
         j = j % #loop + 1
         if IsMouseButtonPressed(3) then  -- only when RMB pressed
            MoveMouseRelative(loop[j].x, loop[j].y)
         end
         Sleep(loop[j].delay)
      until not IsMouseButtonPressed(1)
   end
end

更新:
反后坐力仅在鼠标右键按下时起作用。

于 2020-07-06T05:14:40.587 回答