zoukankan      html  css  js  c++  java
  • Lua Squad 2.0

    --罗技G502鼠标 SUQAD 自动压枪脚本,作者 Haidnor 游戏ID [妙手回春] 汪氏正骨康复-
    
    --全局功能定义区-------------------------------
    
    --是否允许控制台报告开启状态
    consoleReport = true
    
    --是否开启控制台输出按键事件和按键编号
    outputEventAndArg = false
    
    --全局开关变量,控制鼠标压枪功能
    functionalStatus = false 
    
    
    
    --入口函数区------------------------------------
    
        function OnEvent(event,arg)
            if (event == "PROFILE_ACTIVATED") then
                EnablePrimaryMouseButtonEvents(true)
            elseif event == "PROFILE_DEACTIVATED" then
                EnablePrimaryMouseButtonEvents(false)
            end
            
            if outputEventAndArg then
                ClearLog()
                OutputLogMessage("event = %s, arg = %d
    ", event, arg)
            end
    		
            main(event,arg)    
        end
    
    --主函数,所有的鼠标按键事件都从该函数进入
        --event 鼠标事件
        --arg 鼠标按键参数
        main = function(event,arg)
            if event == "MOUSE_BUTTON_PRESSED" and arg == 1 then 
                mouseKey1(event,arg)
            elseif event == "MOUSE_BUTTON_PRESSED" and arg == 2 then
                mouseKey2(event,arg)
            elseif event == "MOUSE_BUTTON_PRESSED" and arg == 3 then
                mouseKey3(event,arg)
            elseif event == "MOUSE_BUTTON_PRESSED" and arg == 4 then
                mouseKey4(event,arg)
            elseif event == "MOUSE_BUTTON_PRESSED" and  arg == 5 then
                mouseKey5(event,arg)
            elseif event == "MOUSE_BUTTON_PRESSED" and arg == 6 then
                mouseKey6(event,arg)
            elseif event == "MOUSE_BUTTON_PRESSED" and arg == 7 then
                mouseKey7(event,arg)
            elseif event == "MOUSE_BUTTON_PRESSED" and arg == 8 then
                mouseKey8(event,arg)
            elseif event == "MOUSE_BUTTON_PRESSED" and arg == 9 then
                mouseKey9(event,arg)
            elseif event == "MOUSE_BUTTON_PRESSED" and arg == 10 then
                mouseKey10(event,arg)
            elseif event == "MOUSE_BUTTON_PRESSED" and arg == 11 then
                mouseKey11(event,arg)
            end
        end
            
    
    --按键绑定函数区--------------------------------
    
    --按键绑定,LCtrl + 鼠标滚轮向上滚动一格
        bindKey_LCtrl_MouseWheelUp1 = function()
            PressKey(0x1d)
            Sleep(50)
            MoveMouseWheel(1)
            Sleep(50)
            ReleaseKey(0x1d)
        end
        
    --按键绑定,LCtrl + 鼠标滚轮向下滚动一格
        bindKey_LCtrl_MouseWheelDown1 = function()
            PressKey(0x1d)
            Sleep(50)
            MoveMouseWheel(-1)
            Sleep(50)
            ReleaseKey(0x1d)
        end
        
    --按键绑定,t
        bindKey_t = function()
            while (IsMouseButtonPressed(5)) 
            do  
                PressKey(0x14) 
            end
            ReleaseKey(0x14)
        end
        
    --按键绑定,m
        bindKey_m = function()
            PressAndReleaseKey(0x32) 
        end
        
    --按键绑定,1
        bindKey_1 = function()
            PressAndReleaseKey(0x02) 
        end
        
    --函数封装区------------------------------------
      
    --清空控制台内容然后打印制定信息
        --text 自定义字符串
        clearAndPrint = function(text)
            if consoleReport == true then
                ClearLog()
                OutputLogMessage(text)
            end
        end
        
    --移动鼠标后暂停指定时间
        --x x轴移动距离
        --y y轴移动距离
        --ms 移动后暂停时间
        sleepAfterMoveMouse = function(x,y,ms)
            if ms == nil then
                ms = 0
            end
            MoveMouseRelative(x,y)
            Sleep(ms)
        end    
        
    --移动鼠标之前暂停指定时间
        --x x轴移动距离
        --y y轴移动距离
        --ms 移动后暂停时间
        sleepBeforeMoveMouse = function(x,y,ms)
            Sleep(ms)
            MoveMouseRelative(x,y)
        end 
        
    --按下指定按键在指定时间后释放
        --key 按键值
        --ms 按下按键后距离释放的时间
        pressAndReleaseKeySetSleepTime = function(key,ms)
            PressKey(key)
            Sleep(ms)
            ReleaseKey(key)
        end
        
    --功能开关
        --双击间隔小于200ms为开
        --单击间隔大于200ms为关
        lastTime = 0
        setFunctionalStatus = function()
            if GetRunningTime() - lastTime > 300 then
                lastTime = GetRunningTime()
                --functionalStatus = false
                --clearAndPrint(">>>Function false")
            else
                lastTime = GetRunningTime()
                --functionalStatus = true
                --clearAndPrint(">>>Function true")
                switchWeapon()
            end
         end
         
     -- 开启压枪
         setFunctionalOn = function()
             functionalStatus = true
         end
     
     -- 关闭压枪
        setFunctionalOff = function()
             functionalStatus = false
         end
    
    -- 切换武器            
        weaponCount = -1
        switchWeapon = function()
            weaponCount = weaponCount + 1
            if weaponCount == 8 then
                weaponCount = 0
            end
    
            if weaponCount == 0 then
                ClearLog()
                setFunctionalOn()
                OutputLogMessage("AKS74_1P29		_ON")
            elseif weaponCount == 1 then
                ClearLog()
                setFunctionalOn()
                OutputLogMessage("L85A2_ACOG    _ON")
            elseif weaponCount == 2 then
                ClearLog()
                setFunctionalOn()
                OutputLogMessage("AK74M_1P78    _ON")
            elseif weaponCount == 3 then
                ClearLog()
                setFunctionalOn()
                OutputLogMessage("M4_M150    _ON")
            elseif weaponCount == 4 then
                ClearLog()
                setFunctionalOn()
                OutputLogMessage("M4A1_M150    _ON")
            elseif weaponCount == 5 then
                ClearLog()
                setFunctionalOn()
                OutputLogMessage("M4A1_M68    _ON")
            elseif weaponCount == 6 then
                ClearLog()
                setFunctionalOn()
                OutputLogMessage("autoClick    _ON")
            end        
        end
     
     
    -- 自动压枪功能
    
    	-- 车臣 塔利班 AKS74 6倍镜
        AKS74_1P29 = function()
            y = 5.85
            increment = 0.044
            if functionalStatus then
                while (IsMouseButtonPressed(1)) 
                do  
                    MoveMouseRelative(0,y)
                    y = y + increment
                    Sleep(10)
                end
                ReleaseMouseButton(1)
            end
        end
    	
    	-- 英军 L85A2 四倍镜
        L85A2_ACOG = function()
            y = 3.2
            increment = 0.0347
            if functionalStatus then
                while (IsMouseButtonPressed(1)) 
                do  
                    MoveMouseRelative(0,y)
                    y = y + increment
                    Sleep(10)
                end
                ReleaseMouseButton(1)
            end
        end
    
    	-- 俄军 AK74M 4倍镜
        AK74M_1P78 = function()
            y = 3.2
            increment = 0.041
            if functionalStatus then
                while (IsMouseButtonPressed(1)) 
                do  
                    MoveMouseRelative(0,y)
                    y = y + increment
                    Sleep(10)
                end
                ReleaseMouseButton(1)
            end
        end
    
        -- 美军M4 4倍镜 三连发
        M4_M150 = function()
    	    count = 1
            y = 4.65
            increment = 0.015
            if functionalStatus then
                while (IsMouseButtonPressed(1)) 
                do  
                    MoveMouseRelative(0,y)
                    y = y + increment
    			  Sleep(5)
                    count = count + 1
                    if count == 15 then
    				--return
    			      ReleaseMouseButton(1)
                        PressMouseButton(1)
    			      count = 1
    			  end
                end
                ReleaseMouseButton(1)
    			count = 1
            end
        end
       
        -- 美军队长 4倍镜 全自动
        M4A1_M150 = function()
            y = 6.7
            increment = 0.085
            if functionalStatus then
                while (IsMouseButtonPressed(1)) 
                do  
                    MoveMouseRelative(0,y)
                    y = y + increment
                    Sleep(10)
                end
                ReleaseMouseButton(1)
            end
        end
    
        -- 美军 1.5倍镜 全自动
        M4A1_M68 = function()
            y = 3.25
            increment = 0.036
            if functionalStatus then
                while (IsMouseButtonPressed(1)) 
                do  
                    MoveMouseRelative(0,y)
                    y = y + increment
                    Sleep(10)
                end
                ReleaseMouseButton(1)
            end
        end
    
        -- 鼠标连点
        autoClick = function()
            if functionalStatus then
                while (IsMouseButtonPressed(1)) 
                do  
                    PressMouseButton(1)
                    Sleep(100)
                    ReleaseMouseButton(1)
                end
                ReleaseMouseButton(1)
            end
        end
    
    --按键功能设置区--------------------------------   
    
        mouseKey2 = function(event,arg)
        	
        end   
    
        mouseKey3 = function(event,arg)
            
        end
       
        mouseKey4 = function(event,arg)
            
        end
    
    -- 切换武器
        mouseKey5 = function(event,arg)
            setFunctionalStatus()
        end
    
    -- 绑定 M 按键   
        mouseKey6 = function(event,arg)
            bindKey_m()
        end
    
    -- 关闭压功能 
        mouseKey7 = function(event,arg)
            setFunctionalOff()
    	    ClearLog()
            OutputLogMessage("OFF")
        end 
    
    -- 开启功能,并切换开火模式
        mouseKey8 = function(event,arg)
     	    --bindKey_1()
    	    if weaponCount == 0 then
                ClearLog()
                setFunctionalOn()
                OutputLogMessage("AKS74_1P29		_ON")
            elseif weaponCount == 1 then
                ClearLog()
                setFunctionalOn()
                OutputLogMessage("L85A2_ACOG    _ON")
            elseif weaponCount == 2 then
                ClearLog()
                setFunctionalOn()
                OutputLogMessage("AK74M_1P78    _ON")
            elseif weaponCount == 3 then
                ClearLog()
                setFunctionalOn()
                OutputLogMessage("M4_M150    _ON")
            elseif weaponCount == 4 then
                ClearLog()
                setFunctionalOn()
                OutputLogMessage("M4A1_M150    _ON")
            elseif weaponCount == 5 then
                ClearLog()
                setFunctionalOn()
                OutputLogMessage("M4A1_M68    _ON")
            elseif weaponCount == 6 then
                ClearLog()
                setFunctionalOn()
                OutputLogMessage("autoClick    _ON")
            end  
        end  
    
        mouseKey9 = function(event,arg)
          
        end  
    
        mouseKey10 = function(event,arg)
        
        end  
    
        mouseKey11 = function(event,arg)
        
        end
    
    -- 开火功能
        mouseKey1 = function(event,arg)
            if weaponCount == 0 then
                AKS74_1P29()
            elseif weaponCount == 1 then
                L85A2_ACOG()
            elseif weaponCount == 2 then
                AK74M_1P78()
            elseif weaponCount == 3 then
                M4_M150()
            elseif weaponCount == 4 then
                M4A1_M150()
            elseif weaponCount == 5 then
                M4A1_M68()
            elseif weaponCount == 6 then
                autoClick()
            end
        end
    
  • 相关阅读:
    快速排序算法
    excel取值
    5.管理控制文件和日志文件
    贝叶斯决策与参数估计小结
    Kernel Methods (5) Kernel PCA
    Kernel Methods (4) Kernel SVM
    Kernel Methods (3) Kernel Linear Regression
    Kernel Methods (2) Kernel function
    Kernel Methods (1) 从简单的例子开始
    PCA算法是怎么跟协方差矩阵/特征值/特征向量勾搭起来的?
  • 原文地址:https://www.cnblogs.com/Haidnor/p/12756787.html
Copyright © 2011-2022 走看看