WIP: add no_recoil
This commit is contained in:
parent
eabeb3d7d3
commit
c947570ddb
1 changed files with 68 additions and 0 deletions
68
main.py
68
main.py
|
@ -267,6 +267,74 @@ class Cheat(Hack):
|
||||||
|
|
||||||
self.hack_loop(cheat)
|
self.hack_loop(cheat)
|
||||||
|
|
||||||
|
def no_recoil(self) -> None:
|
||||||
|
# Aliases
|
||||||
|
mem = self.pm
|
||||||
|
offset = self.offsets
|
||||||
|
|
||||||
|
# Get module addresses
|
||||||
|
client = self.find_module("client")
|
||||||
|
engine = self.find_module("engine")
|
||||||
|
|
||||||
|
# Get local player
|
||||||
|
local_player = self.find_uint(client, offset["dwLocalPlayer"])
|
||||||
|
|
||||||
|
old_punch_x = 0.
|
||||||
|
old_punch_y = 0.
|
||||||
|
|
||||||
|
def cheat():
|
||||||
|
# TODO: Reduce read/write call
|
||||||
|
|
||||||
|
# Check if player is shooting
|
||||||
|
if mem.read_int(local_player + offset["m_iShotsFired"]):
|
||||||
|
client_state = mem.read_uint(engine + offset["dwClientState"])
|
||||||
|
|
||||||
|
# 4 = offset of integer
|
||||||
|
|
||||||
|
# view angle
|
||||||
|
view_angles_x = mem.read_float(
|
||||||
|
client_state + offset["dwClientState_ViewAngles"])
|
||||||
|
view_angles_y = mem.read_float(
|
||||||
|
client_state + offset["dwClientState_ViewAngles"] + 4)
|
||||||
|
|
||||||
|
server_mult = 2.
|
||||||
|
|
||||||
|
# recoil
|
||||||
|
aim_punch_x = mem.read_float(
|
||||||
|
client_state + offset["m_aimPunchAngle"]) * server_mult
|
||||||
|
aim_punch_y = mem.read_float(
|
||||||
|
client_state + offset["m_aimPunchAngle"] + 4) * server_mult
|
||||||
|
|
||||||
|
# New angles
|
||||||
|
new_angle_x = view_angles_x + old_punch_x - aim_punch_x
|
||||||
|
new_angle_y = view_angles_y + old_punch_y - aim_punch_y
|
||||||
|
|
||||||
|
# Sanity check
|
||||||
|
if new_angle_x > 89.:
|
||||||
|
new_angle_x = 89.
|
||||||
|
if new_angle_x < -89.:
|
||||||
|
new_angle_x = -89
|
||||||
|
while (new_angle_y > 180.):
|
||||||
|
new_angle_y -= 360.
|
||||||
|
while (new_angle_y < -180.):
|
||||||
|
new_angle_y += 360.
|
||||||
|
|
||||||
|
# Cancel recoil
|
||||||
|
mem.write_float(
|
||||||
|
client_state + offset["dwClientState_ViewAngles"], new_angle_x)
|
||||||
|
mem.write_float(
|
||||||
|
client_state + offset["dwClientState_ViewAngles"] + 4, new_angle_y)
|
||||||
|
|
||||||
|
old_punch_x = aim_punch_x
|
||||||
|
old_punch_y = aim_punch_y
|
||||||
|
|
||||||
|
else:
|
||||||
|
# Not spraying
|
||||||
|
old_punch_x = 0.
|
||||||
|
old_punch_y = 0.
|
||||||
|
|
||||||
|
self.hack_loop(cheat)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
# Cheat
|
# Cheat
|
||||||
|
|
Reference in a new issue