This repository has been archived on 2023-09-02. You can view files and clone it, but cannot push or open issues or pull requests.
csh/cheats/fov.py
2023-04-01 15:22:27 +02:00

49 lines
1.3 KiB
Python

from win32api import GetAsyncKeyState
from hack import Hack
class Fov(Hack):
def __init__(self) -> None:
super().__init__()
self.__fov = None
self.__factor = 5
def fov(self) -> None:
# Aliases
mem = self.pm
offset = self.offsets
# Get module addresses
client = self.find_module("client")
# Get local player
local_player = self.find_uint(client, offset["dwLocalPlayer"])
# Get FOV
self.__fov = self.find_uint(local_player, offset["m_iDefaultFOV"])
def cheat():
if self.__fov == None:
raise ValueError("FOV isn't defined.")
fov = self.__fov
# Reset FOV
if GetAsyncKeyState(self.vmap["END"]):
self.__fov = 90
# Increase FOV
elif GetAsyncKeyState(self.vmap["PAGE_DOWN"]) and self.__fov < 130:
self.__fov += self.__factor
# Decrease FOV
elif GetAsyncKeyState(self.vmap["PAGE_UP"]) and self.__fov > 50:
self.__fov -= self.__factor
# If modified
if fov != self.__fov:
mem.write_int(
local_player + offset["m_iDefaultFOV"], self.__fov)
self.hack_loop(cheat)