add triggerbot

This commit is contained in:
Mylloon 2023-03-30 15:29:29 +02:00
parent af0fd042d3
commit f5eda2230d
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

53
main.py
View file

@ -4,6 +4,7 @@ from time import sleep
from pymem import Pymem
from requests import get
from win32api import GetAsyncKeyState
from win32con import EM_LINEINDEX, VK_SPACE
class Hack():
@ -109,7 +110,7 @@ class Cheat(Hack):
def cheat():
# Pressing space bar
if not GetAsyncKeyState(ord(" ")):
if not GetAsyncKeyState(VK_SPACE):
return
# Check if player is alive
@ -216,6 +217,56 @@ class Cheat(Hack):
self.hack_loop(cheat)
def triggerbot(self) -> None:
# Aliases
mem = self.pm
offset = self.offsets
# Get module address
client = self.find_module("client")
# Get local player
local_player = self.find_uint(client, offset["dwLocalPlayer"])
# Get local team
local_team = self.find_uint(local_player, offset["m_iTeamNum"])
def cheat():
# Pressing trigger key
if not GetAsyncKeyState(EM_LINEINDEX):
return
# Check if player is alive
if not mem.read_int(local_player + offset["m_iHealth"]):
return
# Get crosshair info about what we aiming at
crosshair_id = mem.read_int(
local_player + offset["m_iCrosshairId"])
# 0 is wall, +64 isn't a player
if (crosshair_id == 0) or (crosshair_id > 64):
return
# Get ennemy under crosshair
ennemy = mem.read_uint(
client + offset["dwEntityList"] + (crosshair_id - 1) * offset["entity_size"])
# Check if ennemy is alive
if not mem.read_int(ennemy + offset["m_iHealth"]):
return
# Ignore allies
if mem.read_int(ennemy + offset["m_iTeamNum"]) == local_team:
return
# Shoot
mem.write_uint(client + offset["dwForceAttack"], 6)
sleep(0.2)
mem.write_uint(client + offset["dwForceAttack"], 4)
self.hack_loop(cheat)
if __name__ == "__main__":
# Cheat