0ADC

From GTAMods Wiki
Jump to navigation Jump to search

GTA III Vice City San Andreas (with CLEO)


Description
Tests the cheat
Syntax
0ADC:   test_cheat "[string]"
Parameter
[string]
Input cheat, maximum 30 characters

This conditional CLEO opcode returns true if the specified string of letters has been typed on the keyboard as though you are inputting a cheat code. Any lower case letters (a-z) are converted to upper case by CLEO during run-time.

Example

The following example is from the Jump and Fly mod for GTA III. It allows you to continue jumping while airborne, effectively allowing you to travel through the air. Type "JUMPANDFLY" to toggle this effect on or off.

// set constants
const
IS_ENABLED = 0@
PLAYER_STRUCT = 1@
end

// initialise
IS_ENABLED = 0

while true
    wait 10
    if
        0ADC:   test_cheat "JUMPANDFLY"
    then
        if
            IS_ENABLED == 0
        then
            0ACA: show_text_box "Cheat activated"
            IS_ENABLED = 1
        else
            0ACA: show_text_box "Cheat deactivated"
            IS_ENABLED = 0
        end
    end
    if and
        IS_ENABLED == 1
        00E1:   player 0 pressed_button 14  // jump key
    then
        0A8D: PLAYER_STRUCT = read_memory 0x9412F0 size 4 virtual_protect 0
        0AA6: call_method 0x4D73D0 struct PLAYER_STRUCT num_params 0 pop 0  // CPed::SetJump
    end
end

Keywords

test, cheat