14 февраля 2022 г.

Переключение режима ходьбы

Теперь для ходьбы в GTA SA не нужно постоянно держать соответствующую кнопку. Нажмите её — и режим ходьбы включится, а для его отключения используйте кнопку «Спринт».

{$CLEO}
0000: // Made by Vital

while true
    wait 0
    
    if
        player.Defined(0)
    then
        0A8D: 0@ = read_memory 0xB73482 size 4 virtual_protect 0
        
        if
            0@ == 255
        then
            while true
                
                if
                    not actor.Driving($PLAYER_ACTOR)
                then
                    if and
                        00E1:   player 0 pressed_key 16
                        player.Controllable(0)
                    then
                        break
                    else
                        cleo_call @EmulatePlayerButtonWithSensitivity 3 0 21 255
                    end
                end
                
                wait 0
            end
        end
    end
end

:EmulatePlayerButtonWithSensitivity
const
 player_id = 0@
 button_id = 1@
 sensitivity = 2@
 bt_address = 0xB73458
 bt_offset = 0x1AC
end // const

player_id *= bt_offset
button_id *= 2
button_id += bt_address
005A: button_id += player_id

0A8C: write_memory button_id size 2 value sensitivity virtual_protect 0
cleo_return 0

Комментариев нет: