60 lines
2 KiB
Python
60 lines
2 KiB
Python
from hack import Hack
|
|
from struct import pack
|
|
|
|
|
|
class Chams(Hack):
|
|
def __init__(self) -> None:
|
|
super().__init__()
|
|
|
|
def chams(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"])
|
|
|
|
def cheat():
|
|
# Loop all entities
|
|
for i in range(1, 32): # 0 is world
|
|
entity = mem.read_uint(
|
|
client + offset["dwEntityList"] + i * offset["entity_size"])
|
|
|
|
# Ignore if entity doesn't exist
|
|
if not entity:
|
|
continue
|
|
|
|
# Ignore allies
|
|
if mem.read_int(entity + offset["m_iTeamNum"]) == mem.read_int(local_player + offset["m_iTeamNum"]):
|
|
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
|
|
|
|
# Space between values
|
|
i = mem.read_int(
|
|
entity + offset["m_iGlowIndex"]) * offset["glow_obj_size"]
|
|
|
|
# Change color
|
|
mem.write_uint(
|
|
entity + offset["m_clrRender"] + offset["render_R"], 255)
|
|
mem.write_uint(
|
|
entity + offset["m_clrRender"] + offset["render_G"], 255)
|
|
|
|
brightness = 5.
|
|
mem.write_int(
|
|
engine + offset["model_ambient_min"],
|
|
int.from_bytes(pack("f", brightness), byteorder='little') ^ (
|
|
engine + offset["model_ambient_min"] - 0x2C)
|
|
)
|
|
|
|
self.hack_loop(cheat)
|