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/radarhack.py

50 lines
1.4 KiB
Python
Raw Normal View History

2023-03-31 18:52:22 +02:00
from hack import Hack
class Radarhack(Hack):
2023-04-01 16:11:56 +02:00
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
2023-03-31 18:52:22 +02:00
2023-04-04 11:06:18 +02:00
def radarhack(self) -> None:
2023-03-31 18:52:22 +02:00
# 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"])
def cheat():
# Loop all entities
for i in range(1, 32): # 0 is world
2023-05-05 16:04:06 +02:00
entity = int(
mem.read_uint(
client + offset["dwEntityList"] + i * offset["entity_size"]
)
)
2023-03-31 18:52:22 +02:00
# Ignore if entity doesn't exist
if not entity:
continue
# Ignore allies
2023-05-05 16:04:06 +02:00
if mem.read_int(entity + offset["m_iTeamNum"]) == mem.read_int(
local_player + offset["m_iTeamNum"]
):
2023-03-31 18:52:22 +02:00
continue
# Ignore dormant
if mem.read_bool(entity + offset["m_bDormant"]):
continue
# Check if ennemy is alive
if mem.read_int(entity + offset["m_lifeState"]):
continue
# Mark ennemy as spotted
2023-03-31 18:52:22 +02:00
mem.write_bool(entity + offset["m_bSpotted"], True)
self.hack_loop(cheat)