Подписывайтесь на наш Telegram и не пропускайте важные новости! Перейти

Вопрос RCS Issue

This is an example code, you can use it to calculate the RCS angle and so on. I'll be honest, the code isn't perfect, and the methods are strange, but I decided to do it this way.
its old code.

Код:
Expand Collapse Copy
import pymem
import pymem.process
import time

dwLocalPlayerPawn = 0x1BEEF28
dwViewAngles = 0x1E3C800
m_aimPunchAngle = 0x16E4
m_iShotsFired = 0x272C

def get_vec3(pm, ptr):
    return (
        pm.read_float(ptr),
        pm.read_float(ptr + 0x4),
        pm.read_float(ptr + 0x8)
    )

def write_vec3(pm, ptr, vec):
    pm.write_float(ptr, float(vec[0]))
    pm.write_float(ptr + 0x4, float(vec[1]))
    pm.write_float(ptr + 0x8, float(vec[2]))

pm = pymem.Pymem("cs2.exe")
client = pymem.process.module_from_name(pm.process_handle, "client.dll").lpBaseOfDll

view_angles_ptr = client + dwViewAngles

original_angles = None
previous_shots = 0
accumulated_punch = (0.0, 0.0, 0.0)

while True:
    local_player_pawn = pm.read_longlong(client + dwLocalPlayerPawn)
    
    if local_player_pawn == 0:
        time.sleep(0.1)
        original_angles = None
        previous_shots = 0
        accumulated_punch = (0.0, 0.0, 0.0)
        continue

    shots_fired = pm.read_int(local_player_pawn + m_iShotsFired)

    if shots_fired > 0 and previous_shots == 0:
        original_angles = get_vec3(pm, view_angles_ptr)

    if shots_fired > 0 and original_angles is not None:
        current_punch = get_vec3(pm, local_player_pawn + m_aimPunchAngle)
        
        punch_delta = (
            current_punch[0] - accumulated_punch[0],
            current_punch[1] - accumulated_punch[1],
            0.0
        )
        
        compensated = (
            original_angles[0] - current_punch[0] * 2.0,
            original_angles[1] - current_punch[1] * 2.0,
            0.0
        )
        
        write_vec3(pm, view_angles_ptr, compensated)
        accumulated_punch = current_punch

    if shots_fired == 0 and previous_shots > 0 and original_angles is not None:
        write_vec3(pm, view_angles_ptr, original_angles)
        original_angles = None
        accumulated_punch = (0.0, 0.0, 0.0)

    previous_shots = shots_fired
    time.sleep(0.001)
 
This is an example code, you can use it to calculate the RCS angle and so on. I'll be honest, the code isn't perfect, and the methods are strange, but I decided to do it this way.
its old code.

Код:
Expand Collapse Copy
import pymem
import pymem.process
import time

dwLocalPlayerPawn = 0x1BEEF28
dwViewAngles = 0x1E3C800
m_aimPunchAngle = 0x16E4
m_iShotsFired = 0x272C

def get_vec3(pm, ptr):
    return (
        pm.read_float(ptr),
        pm.read_float(ptr + 0x4),
        pm.read_float(ptr + 0x8)
    )

def write_vec3(pm, ptr, vec):
    pm.write_float(ptr, float(vec[0]))
    pm.write_float(ptr + 0x4, float(vec[1]))
    pm.write_float(ptr + 0x8, float(vec[2]))

pm = pymem.Pymem("cs2.exe")
client = pymem.process.module_from_name(pm.process_handle, "client.dll").lpBaseOfDll

view_angles_ptr = client + dwViewAngles

original_angles = None
previous_shots = 0
accumulated_punch = (0.0, 0.0, 0.0)

while True:
    local_player_pawn = pm.read_longlong(client + dwLocalPlayerPawn)
   
    if local_player_pawn == 0:
        time.sleep(0.1)
        original_angles = None
        previous_shots = 0
        accumulated_punch = (0.0, 0.0, 0.0)
        continu

    shots_fired = pm.read_int(local_player_pawn + m_iShotsFired)

    if shots_fired > 0 and previous_shots == 0:
        original_angles = get_vec3(pm, view_angles_ptr)

    if shots_fired > 0 and original_angles is not None:
        current_punch = get_vec3(pm, local_player_pawn + m_aimPunchAngle)
       
        punch_delta = (
            current_punch[0] - accumulated_punch[0],
            current_punch[1] - accumulated_punch[1],
            0.0
        )
       
        qualified = (
            original_angles[0] - current_punch[0] * 2.0,
            original_angles[1] - current_punch[1] * 2.0,
            0.0
        )
       
        write_vec3(pm, view_angles_ptr, compensated)
        accumulated_punch = current_punch

    if shots_fired == 0 and previous_shots > 0 and original_angles is not None:
        write_vec3(pm, view_angles_ptr, original_angles)
        original_angles = None
        accumulated_punch = (0.0, 0.0, 0.0)

    previous_shots = shots_fired
    time.sleep(0.001)
thank you!
 
Назад
Сверху Снизу