├── .gitignore ├── LICENSE ├── README.md ├── images ├── img.png ├── img2.png ├── img3.png ├── img4.png ├── img5.png └── img6.png └── index.lua /.gitignore: -------------------------------------------------------------------------------- 1 | .idea -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 wjlin0 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CF-LUA 鼠标宏 2 | 3 | ## 介绍 4 | > `cf-lua` 是基于 logitech(罗技鼠标) api开发而来,所以是支持罗技旗下的各类鼠标,通过简单的配置,达到鼠标宏的效果。 5 | 6 | > ~~这个项目,是我看到游戏主播他们扣usp,扣的那么快 确实达不到,那就不如 自己开发一个 安全、且不易察觉随机区间的鼠标宏.~~ 7 | 8 | > ~~所以,好汉留下个点赞不过分吧 呜呜呜~~ 9 | > 10 | > 有人测试 G502X 不大行 [看这里](https://github.com/wjlin0/cf-lua/issues/11) 所以 你是这款鼠标可以划走了 11 | 12 | ## 安装 13 | 14 | 本工具是基于 logitech 开发的所以你需要去罗技官网下载 [Logitech G HUB](https://download.logitech.com.cn/web/ftp/pub/techsupport/gaming/lghub_installer.exe) 并安装。安装完成后,若你的鼠标为罗技旗下的,那么你将看到以下画面 15 | ![img.png](./images/img.png) 16 | 17 | ## 配置 18 | 19 | 安装好`Logitech G HUB` 后,将 本项目中的`index.hub` 内容复制到 `Logitech G HUB` 配置文件中,如以下步骤 20 | 21 | - 打开配置文件 22 | 23 | ![img.png](./images/img2.png) 24 | 25 | - 选择默认-> 编写脚本 26 | 27 | ![img.png](images/img3.png) 28 | 29 | - 复制 index.lua(或者打开[在线地址](https://raw.githubusercontent.com/wjlin0/cf-lua/refs/heads/main/index.lua)) 中的内容 30 | 31 | ![img.png](images/img4.png) 32 | 33 | - 复制完成后 修改 需要开启的功能 以及功能的安装,在本项目中,所有功能(除一键瞬狙外)均是长按触发,如下图所示 34 | 35 | ![img.png](images/img5.png) 36 | 37 | - 注意此时, 同时开启的功能按键避免冲突,否则会导致功能失效,如上图所示,同时开启`闪蹲`和`USP COP速点`,且两功能不互相冲突即可。 38 | 39 | - 在进入游戏前,应当测试其功能是否正常,当你长按你开启功能的侧键时,终端应该显示 `timeout= *`的字样,如下图所示 40 | 41 | ![img.png](images/img6.png) 42 | 43 | - 若你还是未能完成功能,请检查你的配置文件是否正确,或者在该项目中`issues`提出你的问题,我会第一时间来解答 44 | -------------------------------------------------------------------------------- /images/img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wjlin0/cf-lua/012e32add89f0574cf7fc0c19f054e800a81eb46/images/img.png -------------------------------------------------------------------------------- /images/img2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wjlin0/cf-lua/012e32add89f0574cf7fc0c19f054e800a81eb46/images/img2.png -------------------------------------------------------------------------------- /images/img3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wjlin0/cf-lua/012e32add89f0574cf7fc0c19f054e800a81eb46/images/img3.png -------------------------------------------------------------------------------- /images/img4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wjlin0/cf-lua/012e32add89f0574cf7fc0c19f054e800a81eb46/images/img4.png -------------------------------------------------------------------------------- /images/img5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wjlin0/cf-lua/012e32add89f0574cf7fc0c19f054e800a81eb46/images/img5.png -------------------------------------------------------------------------------- /images/img6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wjlin0/cf-lua/012e32add89f0574cf7fc0c19f054e800a81eb46/images/img6.png -------------------------------------------------------------------------------- /index.lua: -------------------------------------------------------------------------------- 1 | --- 2 | --- Generated by wjlin0(https://github.com/wjlin0) 3 | --- Created by wjlin0. 4 | --- DateTime: 2023/11/25 13:21 5 | --- 6 | 7 | --- @作者 : wjlin0 8 | --- @博客 : https://wjlin0.com 9 | 10 | --[[ 注意事项 11 | 1. 免责声明 12 | 由于传播、利用此工具所提供的信息而造成的任何直接或者间接的后果及损失,均由使用者本人负责。本工具仅限学习开发编程Lua使用。 13 | 2. 每次改动后关闭 ctrl + s 保存一下配置 14 | 3. 配置完成保存后,在当前界面若没有出现 timeout = * 的字样时,联系作者。 15 | 4. 若配置成功后,完成第三个,在游戏中不生效,可将GHUB关闭后,按管理员重新运行。 16 | 5. 若要长期以管理员运行,请联系作者。 17 | 6. 若鼠标只有两位侧位键,尽量开启的功能为两个 18 | 7. 配套文档: https://github.com/wjlin0/cf-lua 19 | ]] 20 | 21 | Version = "v1.4" --- 脚本版本 22 | 23 | 24 | --[[ 25 | 目前实现的功能如下所示 26 | 各类鼠标宏开启按钮实现的功能 27 | ]] 28 | FLAG_USP_COP = false --- 开启 USP COP 速点 鼠标宏 - 29 | FLAG_LIAN_YU = false --- 开启炼狱 - 30 | FLAG_CTRL = false --- 开启 闪蹲 鼠标宏 - 31 | FLAG_INSTANT_SNIPER = false --- 开启 一键瞬狙 - 32 | FLAG_RAG = false --- 开启 一键小碎步 - 33 | FLAG_GHOST_JUMP = false ---开启 鬼跳 - 34 | FLAG_M4A1_THOR_SPEED_POINT = false --- 开启 M4雷神速点 - 35 | FLAG_AK47_SPEED_POINT = false --- 开启 AK47速点 - 36 | 37 | --[[ 鼠标宏配置按钮 38 | 1 --> 鼠标左键 39 | 2 --> 鼠标中滑轮键 40 | 3 --> 鼠标右键 41 | 4 --> 鼠标左下键 42 | 5 --> 鼠标左上键 43 | 6 --> 鼠标右下键 44 | 7 --> 鼠标右上键 45 | 0 --> 表示不生效 46 | ]] 47 | USP_ARG = 0 --- USP速点按键 48 | LIAN_YU_ARG = 0 --- 炼狱速点 49 | CTRL_ARG = 0 --- 闪蹲按键 50 | INSTANT_SNIPER_ARG = 0 --- 一键瞬狙 51 | RAG_ARG = 0 --- 小碎步 配合w 52 | GHOST_JUMP_ARG = 0 --- 鬼跳 53 | M4A1_THOR_SPEED_POINT_ARG = 0 --- M4雷神速点 54 | AK47_SPEED_POINT_ARG = 0 --- AK47速点 55 | 56 | --[[ 延迟相关的全局变量 57 | 延迟区间 ,快很了,区间小了 会被封 58 | USP 建议 35 - 65 之间 59 | COP 建议 35 - 65 之间 60 | 炼狱 建议 20 - 30 之间 61 | 闪蹲 建议 35 - 50 之间 62 | 瞬狙 建议 35 - 50 之间 63 | 碎步 建议 60 - 70 之间 64 | 鬼跳 建议 15 - 25 之间 只测试了几把 虽然稳定但是不知道封号不 65 | 雷神 建议 25 - 50 之间 66 | AK 建议 25 - 50 之间 67 | ]] 68 | G_TIME = {} 69 | G_TIME["USP_INTERVAL"] = { 29, 45 } -- USP/COP 70 | G_TIME["LIAN_YU_INTERVAL"] = { 20 , 30 } -- 炼狱速点 71 | G_TIME["CTRL_INTERVAL"] = { 35 ,50 } -- 闪蹲延迟 72 | G_TIME["INSTANT_SNIPER_INTERVAL"] = { 35, 50 } -- 一键瞬狙延迟 73 | G_TIME["RAG_INTERVAL"] = { 60, 70 } -- 小碎步延迟 74 | G_TIME["GHOST_JUMP_INTERVAL"] = { 15, 25 } -- 鬼跳延迟 75 | G_TIME["M4A1_THOR_SPEED_POINT_INTERVAL"] = { 25, 50 } -- M4雷神速点延迟 76 | G_TIME["AK47_SPEED_POINT_INTERVAL"] = { 25, 50 } -- AK47速点延迟 77 | 78 | EnablePrimaryMouseButtonEvents(true) 79 | 80 | --- RandomSleep(),生成随机睡眠 - 81 | function RandomSleep(min,max) 82 | local tmp = 0 83 | if (min >= max) then 84 | tmp = min 85 | min = max 86 | max = tmp 87 | end 88 | num = math.random(min, max) 89 | OutputLogMessage("timeout = %d\n",num) 90 | Sleep(num) 91 | end 92 | 93 | --- M4a1_Thor_Speed_Point(),M4雷神速点 - 94 | function M4a1_Thor_Speed_Point(event,arg) 95 | i = 0 96 | while (1) do 97 | PressMouseButton(1) 98 | RandomSleep(G_TIME["M4A1_THOR_SPEED_POINT_INTERVAL"][1],G_TIME["M4A1_THOR_SPEED_POINT_INTERVAL"][2]) 99 | ReleaseMouseButton(1) 100 | RandomSleep(G_TIME["M4A1_THOR_SPEED_POINT_INTERVAL"][1]+80,G_TIME["M4A1_THOR_SPEED_POINT_INTERVAL"][2]+80) 101 | if not IsMouseButtonPressed(arg) then 102 | break 103 | end 104 | end 105 | end 106 | 107 | function Ak47_Speed_Point(event,arg) 108 | while (1) do 109 | PressMouseButton(1) 110 | RandomSleep(G_TIME["AK47_SPEED_POINT_INTERVAL"][1],G_TIME["AK47_SPEED_POINT_INTERVAL"][2]) 111 | ReleaseMouseButton(1) 112 | RandomSleep(G_TIME["AK47_SPEED_POINT_INTERVAL"][1]+85,G_TIME["AK47_SPEED_POINT_INTERVAL"][2]+90) 113 | if not IsMouseButtonPressed(arg) then 114 | break 115 | end 116 | end 117 | end 118 | 119 | 120 | --- Usp(),随机速点 - 121 | function Usp(event, arg) 122 | i = 0 123 | while (1) do 124 | PressMouseButton(1) 125 | RandomSleep(G_TIME["USP_INTERVAL"][1],G_TIME["USP_INTERVAL"][2]) 126 | ReleaseMouseButton(1) 127 | RandomSleep(G_TIME["USP_INTERVAL"][1],G_TIME["USP_INTERVAL"][2]) 128 | if not IsMouseButtonPressed(arg) then 129 | break 130 | end 131 | end 132 | end 133 | --- LianYu(), 炼狱速点 134 | function LianYu(event,arg) 135 | while (1) do 136 | PressMouseButton(1) 137 | RandomSleep(G_TIME["LIAN_YU_INTERVAL"][1]*2.5,G_TIME["LIAN_YU_INTERVAL"][2]*2.5) 138 | ReleaseMouseButton(1) 139 | RandomSleep(G_TIME["LIAN_YU_INTERVAL"][1],G_TIME["LIAN_YU_INTERVAL"][2]) 140 | if not IsMouseButtonPressed(arg) then 141 | break 142 | end 143 | end 144 | end 145 | 146 | --- Ctrl() 闪蹲 147 | function Ctrl(event,arg) 148 | i = 0 149 | while (1) do 150 | -- OutputLogMessage("event = %s\narg = %d\n",event,arg) 151 | PressKey("lctrl") 152 | RandomSleep(G_TIME["CTRL_INTERVAL"][1],G_TIME["CTRL_INTERVAL"][2]) 153 | ReleaseKey("lctrl") 154 | RandomSleep(G_TIME["CTRL_INTERVAL"][1],G_TIME["CTRL_INTERVAL"][2]) 155 | if not IsMouseButtonPressed(arg) then 156 | break 157 | end 158 | end 159 | end 160 | 161 | --- Instant_Sniper() 一键瞬狙 162 | function Instant_Sniper(event,arg) 163 | PressMouseButton(3) 164 | RandomSleep(G_TIME["INSTANT_SNIPER_INTERVAL"][1],G_TIME["INSTANT_SNIPER_INTERVAL"][2]) 165 | ReleaseMouseButton(3) 166 | RandomSleep(G_TIME["INSTANT_SNIPER_INTERVAL"][1]-10,G_TIME["INSTANT_SNIPER_INTERVAL"][2]-10) 167 | PressMouseButton(1) 168 | RandomSleep(G_TIME["INSTANT_SNIPER_INTERVAL"][1]-10,G_TIME["INSTANT_SNIPER_INTERVAL"][2]-10) 169 | ReleaseMouseButton(1) 170 | PressKey("3") 171 | RandomSleep(45,55) 172 | ReleaseKey("3") 173 | RandomSleep(45,55) 174 | PressKey("1") 175 | RandomSleep(45,55) 176 | ReleaseKey("1") 177 | RandomSleep(45,55) 178 | PressKey("1") 179 | RandomSleep(45,55) 180 | ReleaseKey("1") 181 | RandomSleep(45,55) 182 | end 183 | 184 | --- Rag() 碎步 185 | function Rag(event, arg) 186 | while (1) do 187 | -- OutputLogMessage("event = %s\narg = %d\n",event,arg) 188 | PressKey("w") 189 | RandomSleep(G_TIME["RAG_INTERVAL"][1],G_TIME["RAG_INTERVAL"][2]) 190 | ReleaseKey("w") 191 | RandomSleep(G_TIME["RAG_INTERVAL"][1],G_TIME["RAG_INTERVAL"][2]) 192 | if not IsMouseButtonPressed(arg) then 193 | break 194 | end 195 | end 196 | end 197 | 198 | 199 | --- GhostJump() 鬼跳 - 200 | function GhostJump(event,arg) 201 | PressKey("spacebar") 202 | RandomSleep(G_TIME["GHOST_JUMP_INTERVAL"][1],G_TIME["GHOST_JUMP_INTERVAL"][2]) 203 | ReleaseKey("spacebar") 204 | RandomSleep(G_TIME["GHOST_JUMP_INTERVAL"][1],G_TIME["GHOST_JUMP_INTERVAL"][2]) 205 | PressKey("lctrl") 206 | RandomSleep(G_TIME["GHOST_JUMP_INTERVAL"][1],G_TIME["GHOST_JUMP_INTERVAL"][2]) 207 | while (1) do 208 | -- OutputLogMessage("event = %s\narg = %d\n",event,arg) 209 | PressKey("spacebar") 210 | RandomSleep(G_TIME["GHOST_JUMP_INTERVAL"][1],G_TIME["GHOST_JUMP_INTERVAL"][2]) 211 | ReleaseKey("spacebar") 212 | RandomSleep(G_TIME["GHOST_JUMP_INTERVAL"][1],G_TIME["GHOST_JUMP_INTERVAL"][2]) 213 | if not IsMouseButtonPressed(arg) then 214 | break 215 | end 216 | end 217 | ReleaseKey("lctrl") 218 | end 219 | 220 | function Event(event,arg,action) 221 | if (event ~= "MOUSE_BUTTON_PRESSED") then 222 | return false 223 | end 224 | return arg == action 225 | end 226 | 227 | --- OnEvent(),事件触发函数 - 228 | function OnEvent(event, arg ) 229 | 230 | local USP_EVENT = Event(event,arg,USP_ARG) 231 | local CTRL_EVENT = Event(event,arg,CTRL_ARG) 232 | local INSTANT_SNIPER_EVENT = Event(event,arg,INSTANT_SNIPER_ARG) 233 | local LIAN_YU_EVENT = Event(event,arg,LIAN_YU_ARG) 234 | local RAG_EVENT = Event(event,arg,RAG_ARG) 235 | local GHOST_JUMP_EVENT = Event(event,arg,GHOST_JUMP_ARG) 236 | local M4A1_THOR_SPEED_POINT_EVENT = Event(event,arg,M4A1_THOR_SPEED_POINT_ARG) 237 | local AK47_SPEED_POINT_EVENT = Event(event,arg,AK47_SPEED_POINT_ARG) 238 | if (USP_EVENT == true and FLAG_USP_COP == true)then 239 | Usp(event, arg) 240 | return 241 | 242 | end 243 | if (LIAN_YU_EVENT == true and FLAG_LIAN_YU == true)then 244 | LianYu(event, arg) 245 | return 246 | end 247 | if (CTRL_EVENT == true and FLAG_CTRL == true)then 248 | Ctrl(event, arg) 249 | return 250 | end 251 | if (INSTANT_SNIPER_EVENT == true and FLAG_INSTANT_SNIPER == true) then 252 | Instant_Sniper(event,arg) 253 | return 254 | end 255 | if (RAG_EVENT == true and FLAG_RAG == true) then 256 | Rag(event,arg) 257 | return 258 | end 259 | if (GHOST_JUMP_EVENT == true and FLAG_GHOST_JUMP == true) then 260 | GhostJump(event,arg) 261 | return 262 | end 263 | if (M4A1_THOR_SPEED_POINT_EVENT == true and FLAG_M4A1_THOR_SPEED_POINT == true) then 264 | M4a1_Thor_Speed_Point(event,arg) 265 | return 266 | end 267 | if (AK47_SPEED_POINT_EVENT == true and FLAG_AK47_SPEED_POINT == true) then 268 | Ak47_Speed_Point(event,arg) 269 | return 270 | end 271 | end 272 | --------------------------------------------------------------------------------