-
Автор темы
- #1
от аддрес игроков смещаюсь на m_iTeamNum = 0x3E3 , все прекрасно пишет.
но если на здоровье, броню, или армор то пишет 0, оффсеты с дампа
вот код
import time
import pymem
import pymem.process
dwEntityList = 0x19BDCF0
dwLocalPlayerPawn = 0x1825158
m_iIDEntIndex = 0x1450
m_iTeamNum = 0x3E3
m_iHealth = 0x344
m_iMaxHealth = 0x340
m_iArmorValue = 0x22D0
def safe_read_int(pm, address):
try:
return pm.read_int(address)
except pymem.exception.MemoryReadError as e:
return 0
def main():
pm = pymem.Pymem("cs2.exe")
client = pymem.process.module_from_name(pm.process_handle, "client.dll").lpBaseOfDll
entList = pm.read_longlong(client + dwEntityList)
for i in range(0, 64):
entEntry = pm.read_longlong(entList + 8 * (i >> 9) + 16)
entEntry2 = pm.read_longlong(entList + ((8 * (i & 0x7FFF) >> 9) + 16))
C_BaseEntity = pm.read_longlong(entEntry + 120 * (i & 0x1FF))
CCSPlayerController = pm.read_longlong(entEntry2 + 120 * (i & 0x1FFF))
if CCSPlayerController != 0:
team_num = safe_read_int(pm, CCSPlayerController+m_iTeamNum)
hp = safe_read_int(pm, CCSPlayerController+m_iHealth)
max_hp = safe_read_int(pm, CCSPlayerController+m_iMaxHealth)
armor = safe_read_int(pm, CCSPlayerController+m_iArmorValue)
if team_num == 2:
team = "Terrorist"
elif team_num == 3:
team = "KT"
else:
team = "Unknown"
if hp >= 0:
print(hex(CCSPlayerController))
print(f"Entity Address: {hex(CCSPlayerController)}, Health: {hp}/{max_hp}, Armor: {armor}, Team: {team}")
if name == "main":
main()
но если на здоровье, броню, или армор то пишет 0, оффсеты с дампа
вот код
import time
import pymem
import pymem.process
dwEntityList = 0x19BDCF0
dwLocalPlayerPawn = 0x1825158
m_iIDEntIndex = 0x1450
m_iTeamNum = 0x3E3
m_iHealth = 0x344
m_iMaxHealth = 0x340
m_iArmorValue = 0x22D0
def safe_read_int(pm, address):
try:
return pm.read_int(address)
except pymem.exception.MemoryReadError as e:
return 0
def main():
pm = pymem.Pymem("cs2.exe")
client = pymem.process.module_from_name(pm.process_handle, "client.dll").lpBaseOfDll
entList = pm.read_longlong(client + dwEntityList)
for i in range(0, 64):
entEntry = pm.read_longlong(entList + 8 * (i >> 9) + 16)
entEntry2 = pm.read_longlong(entList + ((8 * (i & 0x7FFF) >> 9) + 16))
C_BaseEntity = pm.read_longlong(entEntry + 120 * (i & 0x1FF))
CCSPlayerController = pm.read_longlong(entEntry2 + 120 * (i & 0x1FFF))
if CCSPlayerController != 0:
team_num = safe_read_int(pm, CCSPlayerController+m_iTeamNum)
hp = safe_read_int(pm, CCSPlayerController+m_iHealth)
max_hp = safe_read_int(pm, CCSPlayerController+m_iMaxHealth)
armor = safe_read_int(pm, CCSPlayerController+m_iArmorValue)
if team_num == 2:
team = "Terrorist"
elif team_num == 3:
team = "KT"
else:
team = "Unknown"
if hp >= 0:
print(hex(CCSPlayerController))
print(f"Entity Address: {hex(CCSPlayerController)}, Health: {hp}/{max_hp}, Armor: {armor}, Team: {team}")
if name == "main":
main()