Python监控鼠标事件的压枪脚本
2018-02-14 11:11
197 查看
本文仅供学习和交流使用,若使用脚本导致游戏封号或其他后果不负一切责任哈~
其实很简单,主要是监控用户的各种操作,之前花了好久在网上找相关库,都是些什么pyhook,pymouse这种的,要求多不实用而且讲道理也不太友好,对环境还有要求,配置测试好久,虽然也可以吧,后来发现还有pynput,一个库功能齐全,果断就放弃前面的了。当然了,需要 pip install pynput 安装一下。
老样子,直接上代码趴~# coding=utf-8
"""
吃鸡压枪脚本,可以快速单点可以长按,按backspace退格键开启和关闭
——by Joy
"""
import threading
from pynput.mouse import Button, Listener, Controller
from pynput import keyboard
import time
# 记录操作指令
# 射击
shoot = 0
# 倍镜
scope = -1
# 开启压枪状态
status = 1
# 鼠标控制器
controller = Controller()
"""
鼠标事件
"""
def mouse_click(x, y, button, pressed):
global shoot
global scope
if pressed:
# 开启倍镜
if button == Button.right:
scope = - scope
# 开始射击
if button == Button.left:
shoot = 1
# 结束射击
if not pressed and button == Button.left:
shoot = 0
# 监控鼠标位置
def mouse_move(x, y):
print x, y
"""
键盘事件
"""
def keyboard_release(key):
global status
if key == keyboard.Key.backspace:
# 更改压枪状态
status = -status
"""
监听事件方法
"""
def mouseListener():
with Listener(on_click=mouse_click, on_move=mouse_move) as listener:
listener.join()
def keyboardListener():
with keyboard.Listener(
on_release=keyboard_release) as listener:
listener.join()
def main():
threading._start_new_thread(mouseListener, ())
threading._start_new_thread(keyboardListener, ())
# 循环监听各状态并控制鼠标
while 1:
if shoot == 1 and scope == -1 and status == 1:
time.sleep(0.2) # 根据一般的子弹射速有节奏的压枪
controller.move(0, +15)
elif shoot == 1 and scope == 1 and status == 1: # 开启倍镜,增加压枪幅度
time.sleep(0.2)
controller.move(0, +25)
if __name__ == '__main__':
main()
运行脚本测试是OK的,不过没进游戏试过怕被封,233333
其实很简单,主要是监控用户的各种操作,之前花了好久在网上找相关库,都是些什么pyhook,pymouse这种的,要求多不实用而且讲道理也不太友好,对环境还有要求,配置测试好久,虽然也可以吧,后来发现还有pynput,一个库功能齐全,果断就放弃前面的了。当然了,需要 pip install pynput 安装一下。
老样子,直接上代码趴~# coding=utf-8
"""
吃鸡压枪脚本,可以快速单点可以长按,按backspace退格键开启和关闭
——by Joy
"""
import threading
from pynput.mouse import Button, Listener, Controller
from pynput import keyboard
import time
# 记录操作指令
# 射击
shoot = 0
# 倍镜
scope = -1
# 开启压枪状态
status = 1
# 鼠标控制器
controller = Controller()
"""
鼠标事件
"""
def mouse_click(x, y, button, pressed):
global shoot
global scope
if pressed:
# 开启倍镜
if button == Button.right:
scope = - scope
# 开始射击
if button == Button.left:
shoot = 1
# 结束射击
if not pressed and button == Button.left:
shoot = 0
# 监控鼠标位置
def mouse_move(x, y):
print x, y
"""
键盘事件
"""
def keyboard_release(key):
global status
if key == keyboard.Key.backspace:
# 更改压枪状态
status = -status
"""
监听事件方法
"""
def mouseListener():
with Listener(on_click=mouse_click, on_move=mouse_move) as listener:
listener.join()
def keyboardListener():
with keyboard.Listener(
on_release=keyboard_release) as listener:
listener.join()
def main():
threading._start_new_thread(mouseListener, ())
threading._start_new_thread(keyboardListener, ())
# 循环监听各状态并控制鼠标
while 1:
if shoot == 1 and scope == -1 and status == 1:
time.sleep(0.2) # 根据一般的子弹射速有节奏的压枪
controller.move(0, +15)
elif shoot == 1 and scope == 1 and status == 1: # 开启倍镜,增加压枪幅度
time.sleep(0.2)
controller.move(0, +25)
if __name__ == '__main__':
main()
运行脚本测试是OK的,不过没进游戏试过怕被封,233333
相关文章推荐
- Python脚本实现值更新事件赋值过程记录日志监控
- Python中使用PyHook监听鼠标和键盘事件实例
- android2.3 监控鼠标滑动事件(2)
- Python中用pycurl监控http响应时间脚本分享
- Python 监控 Data Guard 脚本
- [置顶] ZABBIX3.2使用python脚本实现监控报表
- 不对窗体进行边框装饰后,实现对鼠标事件的监控
- python脚本监控Tomcat服务器的方法
- python脚本监控磁盘空间
- 用 Python 脚本实现对 Linux 服务器的监控
- 指令脚本redis线上环境监控脚本(python脚本)
- QT中监控全局键盘鼠标事件
- python脚本监控网站状态 推荐
- 用 Python 脚本实现对 Linux 服务器的监控
- 用 Python 脚本实现对 Linux 服务器的监控
- [python] 1、python鼠标点击、移动事件应用——写一个自动下载百度音乐的程序
- python脚本实现监控apache,并使用mail发送报警
- python脚本监控进程,服务停止后自动启动
- python钉钉机器人运维脚本监控
- 【Python运维脚本】Python监控系统负载