04A7

From GTAMods Wiki
Jump to navigation Jump to search

San Andreas IS_CHAR_IN_ANY_BOAT


Description
Checks if the character is in a boat
Syntax
04A7:   actor [char handle] driving_boat
Parameter
[char handle]
The handle of the character
Native analog
IS_CHAR_IN_ANY_BOAT

This conditional opcode returns true if the character is in a boat, either as a driver or a passenger. By default the game will recognize the following list of vehicles as boats (for which the IS_BOAT model flag is set in the handling.cfg file):

  • Coastguard
  • Dinghy
  • Jetmax
  • Launch
  • Marquis
  • Predator
  • Speeder
  • Squalo
  • Reefer
  • Tropic

For GTA III and Vice City

This opcode does not exist in GTA III and Vice City but it is possible to check the type of vehicle a character is in. The following example, using Sanny Builder with CLEO for GTA III and Vice City in an external script (not the main one) and tested on US v1.0, should work similarly to this opcode. Place this at the end of the file for Vice City:

:opcode_04A7
// 0@ - input param (char handle)
if
    00DF:   actor 0@ driving
then
    03C0: 0@ = actor 0@ car
    05E7: 0@ = car 0@ struct
    05E4: call_function_method 0x5BAA80 struct 0@ num_params 0 pop 0 store_to 0@  // get vehicle type
        0@ == 4  // is type boat
end
05F6: ret 0

or for GTA III:

:opcode_04A7
// 0@ - input param (char handle)
if
    00DF:   actor 0@ driving
then
    03C0: 0@ = actor 0@ car
    05E7: 0@ = car 0@ struct
    0@ += 0x284  // vehicle type offset
    05E0: 0@ = read_memory 0@ size 1 virtual_protect 0  // get value
        0@ == 1  // is type boat
end
05F6: ret 0

Use this line as a substitute for opcode 04A7. This can be placed anywhere within the external script as a conditional statement:

// ...
if
    05F5: call_scm_func @opcode_04A7 inputs 1 char_handle [char handle]
then
    // [RETURNED TRUE]
else
    // [RETURNED FALSE]
end
// ...

Keywords

actor, character, driving, any, boat

See also

  • Vice City 04A8, checks if the player is in a boat