吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 1151|回复: 0
收起左侧

[求助] 写了个宏但是不知道哪里有问题一直不正常,求大佬斧正

[复制链接]
nano1707 发表于 2020-3-17 15:13
问题:为了实现左右键同时按下才会压枪,我就做了这个宏,但是经常失效,有时候左右同时按下无反应,有时候又正常,是在莫名其妙!


KG=3--开关键位
ZuoJian=1--左键键位
YouJian=2--右键键位
gun=0--灯光状态阀
KGzt=false--初始开关状态
Zzt=false--左键状态
Yzt=false--右键状态
OnClick=false
-------------------------------压枪参数------ Di_n 不能为0 否则第三发之后所有子弹都不会下压-------------------------------------
akm_speed = 0.01 --增量
AKM_SheJiJianGe = 65 --射击间隔
AKM_PingHua = 5 --平滑参数

--UPM9设置1
AKM_Di_n = 10 --压枪子弹参数
------------------------------其他参数--------------------------------------------
AKM_Speed = 0
AKM_ZiDan_CiShu = 0

function OnEvent(event, arg)
--OutputLogMessage("event = %s, arg = %s\n", event, arg);--允许反馈按键反馈
EnablePrimaryMouseButtonEvents(true);--解除鼠标按键1屏蔽
if(event == "MOUSE_BUTTON_PRESSED" and arg == KG)then
KGzt= not KGzt
if(KGzt)then
OutputLogMessage("On \n")
else
OutputLogMessage("Off \n")
end
if (gun==0)then
PressKey("scrolllock")
gun=1
end
if (gun ==1) then
gun=0
ReleaseKey("scrolllock")
end
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and KGzt) then
Zzt= not Zzt--修改左键状态
end
if (event == "MOUSE_BUTTON_RELEASED" and arg == 1 and KGzt) then
Zzt=false--放开恢复左键状态
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 2 and KGzt) then
Yzt= not Yzt--修改右键状态
end
if (event == "MOUSE_BUTTON_RELEASED" and arg == 2 and KGzt) then
Yzt=false--放开恢复右键状态
end
--------------------执行步骤-------------------------
if (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and Yzt) then
OnClick = not OnClick
YAQIANG_AKM()
end
if (event == "MOUSE_BUTTON_RELEASED" and arg == 1) then
chushi()
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 2 and Zzt) then
OnClick = not OnClick
YAQIANG_AKM()
end
if (event == "MOUSE_BUTTON_RELEASED" and arg == 2) then
chushi()
end
---------------------------增量初始化-------------------------
function chushi()
AKM_Speed = 0
end
-------------------------弹道参数-----------------------------
function YAQIANG_AKM()
AKM_ZiDan_CiShu = 1
repeat
EnablePrimaryMouseButtonEvents(true);--解除鼠标按键1屏蔽
if(IsMouseButtonPressed(1))then--判断开火键是否按下
if(AKM_ZiDan_CiShu >= AKM_PingHua)then
MoveMouseRelative(0,AKM_Di_n/AKM_PingHua + AKM_Speed)
end
Sleep(AKM_SheJiJianGe/AKM_PingHua)
AKM_ZiDan_CiShu = AKM_ZiDan_CiShu + 1
AKM_Speed = AKM_Speed + akm_speed
else
break
end
until (not OnClick )
end
end

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-11-26 18:31

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表