Difference between revisions of "029C"

From GTAMods Wiki
Jump to navigation Jump to search
(Created page with '{{Icon|3}} '''IS_BOAT''' <hr /> <onlyinclude>{{#ifeq:{{{transcludesection|opcode}}}|opcode| '''Description''' : Checks if the vehicle is a boat '''Syntax''' : 029C:   car ['…')
 
m
Line 17: Line 17:
 
<source lang="scm">
 
<source lang="scm">
 
:opcode_029C
 
:opcode_029C
05E7: 0@ = car [car handle] struct
+
05E7: 0@ = car {car handle} struct
// change [car handle] to the actual handle of the vehicle
+
// change {car handle} to the actual handle of the vehicle
 
0@ += 0x29C  // vehicle type offset
 
0@ += 0x29C  // vehicle type offset
 
05E0: 0@ = read_memory 0@ size 1 virtual_protect 0
 
05E0: 0@ = read_memory 0@ size 1 virtual_protect 0
Line 35: Line 35:
 
     gosub @opcode_029C
 
     gosub @opcode_029C
 
then
 
then
     [RETURNED TRUE]
+
     // [RETURNED TRUE]
 
else
 
else
     [RETURNED FALSE]
+
     // [RETURNED FALSE]
 
end
 
end
 
</source>
 
</source>

Revision as of 20:34, 10 January 2012

GTA III IS_BOAT


Description

Checks if the vehicle is a boat

Syntax

029C:   car [car handle] stopped

Parameter

[car handle]
The handle of the vehicle

This opcode returns true if the vehicle is of type boat. Most major documentations had incorrectly described this opcode. This mistake had remained undetected for a very long time.

For Vice City

This opcode does not exist in Vice City, but the game still recognizes vehicles by type. The following example, using Sanny Builder with CLEO for Vice City, and tested on US v1.0, should work similarly to this opcode. Place this at the end of the file:

:opcode_029C
05E7: 0@ = car {car handle} struct
// change {car handle} to the actual handle of the vehicle
0@ += 0x29C  // vehicle type offset
05E0: 0@ = read_memory 0@ size 1 virtual_protect 0
if
    0@ == 1  // is type boat
then
    0485: return_true
else
    059A: return_false
end
return

Use the gosub as a substitute for opcode 029C. This can be placed only within an IF statement:

if
    gosub @opcode_029C
then
    // [RETURNED TRUE]
else
    // [RETURNED FALSE]
end

Keywords

check, stopped, car, boat