0AD9

From GTAMods Wiki
Revision as of 04:37, 18 January 2017 by Spaceeinstein (talk | contribs)
Jump to navigation Jump to search

GTA III Vice City San Andreas (with CLEO)


Description
Writes a formatted text to the file
Syntax
0AD9: write_formatted_text "[string]" in_file [file] ( [any] ... )
Parameter
[string]
Text to write into the file (see fprintf for explanation)
[file]
The handle of the file
[any]
Values to write (any data type)

This CLEO opcode writes a formatted text to the file. In Sanny Builder it is important that you disable case converting in order for the opcode to work as expected. In "Options..." under the "Formats" tab in the "Case converting" box, select "As is". For CLEO v2.0.0.4 and below for GTA III and Vice City, this opcode crashes the game.

Example

The following example allows you to record your positions into a file every time you press button 17 (ATTACK key).

const
FILE_HANDLE = 0@
X_POS = 1@
Y_POS = 2@
Z_POS = 3@
end

0A9A: FILE_HANDLE = openfile "output" mode 0x77  // w
while true
    wait 10
    if
        00E1:   player 0 pressed_button 17  // attack key
    then
        while 00E1:   player 0 pressed_button 17  // attack key
            wait 0
        end
        0054: store_player $PLAYER_CHAR position_to X_POS Y_POS Z_POS
        0AD9: write_formatted_text "%f %f %f%c" in_file FILE_HANDLE data X_POS Y_POS Z_POS 0xA
    end
end

Keywords

write, file, format, formatted, text