031B

From GTAMods Wiki
Jump to navigation Jump to search

GTA III IS_FIRST_CAR_COLOUR


Description
Checks if the vehicle's primary color is equal to the color
Syntax
031B:   car [car handle] primary_color [int]
Parameter
[car handle]
The handle of the vehicle
[int]
Car color

This conditional opcode returns true if the vehicle's primary color is equal to the color. This opcode was never called in the original script of GTA III.

For Vice City

This opcode does not exist in Vice City but it possible to get the vehicle's primary color. The following example, using Sanny Builder with CLEO for 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:

:opcode_031B
// 0@ - input param (car handle)
// 1@ - input param (color)
05E7: 0@ = car 0@ struct
0@ += 0x1A0  // primary color offset
05E0: 0@ = read_memory 0@ size 1 virtual_protect 0
003B:    0@ == 1@
05F6: ret 0

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

// ...
if
    05F5: call_scm_func @opcode_031B inputs 2 car_handle [car handle] color [int]
then
    // [RETURNED TRUE]
else
    // [RETURNED FALSE]
end
// ...

Keywords

check, first, primary, car, vehicle, color, colour

See also

  • GTA III 031C, checks if the vehicle's secondary color is equal to the color