Difference between revisions of "0A30"

From GTAMods Wiki
Jump to navigation Jump to search
(code update)
Line 9: Line 9:
 
:: The handle of the vehicle
 
:: The handle of the vehicle
 
'''Native analog'''
 
'''Native analog'''
: [[FIX CAR]]
+
: [[FIX_CAR]]
  
 
This opcode fixes the vehicle from all damages done to it, including all physical damages like damaged panels or popped tires.
 
This opcode fixes the vehicle from all damages done to it, including all physical damages like damaged panels or popped tires.
  
 
== For GTA III and Vice City ==
 
== For GTA III and Vice City ==
This opcode does not exist in GTA III and Vice City, but there exist a function that behaves similarly to this opcode in both games. The following example, using Sanny Builder with [[CLEO]] for either GTA III or Vice City, and tested on US v1.0, should work similarly to this opcode by tapping into the spray shop function.
+
This opcode does not exist in GTA III and Vice City, but there exist a function used in spray shops that behaves similarly to this opcode in both games. 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, with some changes needed for GTA III, should work similarly to this opcode. Place this at the end of the file:
 
 
 
<source lang="scm">
 
<source lang="scm">
// set constants
+
:opcode_0A30
const
+
// 0@ - input param (car handle)
PLAYER_CAR = 0@
+
0224: set_car 0@ health_to 1000
MEM_VALUE = 1@
+
05E7: 1@ = car 0@ struct
PLAYING_VC = 2@
+
1@ += 0x29C  // vehicle type offset
end
+
05E0: 1@ = read_memory 1@ size 1 virtual_protect 0
 
+
05E7: 0@ = car 0@ struct
PLAYING_VC = true  // if playing III, set to false
 
 
if
 
if
     00E0:  player $PLAYER_CHAR driving
+
     1@ == 0  // is car
 
then
 
then
     03C1: PLAYER_CAR = player $PLAYER_CHAR car
+
     05E3: call_method 0x588530 0@ num_params 0 pop 0 // car repair, for GTA III please use 0x53C240
    0224: set_car PLAYER_CAR health_to 1000
+
else
    if
+
    05E3: call_method 0x609F00 0@ num_params 0 pop 0 // others repair, for GTA III please use 0x53C240
        PLAYING_VC == true
 
    then
 
        05E7: MEM_VALUE = car PLAYER_CAR struct
 
        MEM_VALUE += 0x29C
 
        05E0: MEM_VALUE = read_memory MEM_VALUE size 1 virtual_protect 0
 
        05E7: PLAYER_CAR = car PLAYER_CAR struct
 
        if
 
            MEM_VALUE == 0
 
        then
 
            05E3: call_method 0x588530 PLAYER_CAR num_params 0 pop 0
 
        else
 
            05E3: call_method 0x609F00 PLAYER_CAR num_params 0 pop 0
 
        end
 
    else
 
        05E7: PLAYER_CAR = car PLAYER_CAR struct
 
        05E3: call_method 0x53C240 PLAYER_CAR num_params 0 pop 0
 
    end
 
 
end
 
end
 +
05F6: ret 0
 +
</source>
 +
Use this line as a substitute for opcode 0A30. This can be placed anywhere within the external script:
 +
<source lang="scm">
 +
5F5: call_scm_func @opcode_0A30 inputs 1 car_handle [car handle]  // change [car handle] to the actual handle of the car
 
</source>
 
</source>
  
 
== Keywords ==
 
== Keywords ==
fix, repair, vehicle, car, damage
+
fix, repair, heal, vehicle, car, damage
  
 
== External link ==
 
== External link ==

Revision as of 23:09, 2 January 2012

San Andreas


Description

Fixes the specified vehicle

Syntax

0A30: repair_car [car handle]

Parameter

[car handle]
The handle of the vehicle

Native analog

FIX_CAR

This opcode fixes the vehicle from all damages done to it, including all physical damages like damaged panels or popped tires.

For GTA III and Vice City

This opcode does not exist in GTA III and Vice City, but there exist a function used in spray shops that behaves similarly to this opcode in both games. 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, with some changes needed for GTA III, should work similarly to this opcode. Place this at the end of the file:

:opcode_0A30
// 0@ - input param (car handle) 
0224: set_car 0@ health_to 1000
05E7: 1@ = car 0@ struct
1@ += 0x29C  // vehicle type offset
05E0: 1@ = read_memory 1@ size 1 virtual_protect 0
05E7: 0@ = car 0@ struct
if
    1@ == 0  // is car
then
    05E3: call_method 0x588530 0@ num_params 0 pop 0  // car repair, for GTA III please use 0x53C240
else
    05E3: call_method 0x609F00 0@ num_params 0 pop 0  // others repair, for GTA III please use 0x53C240
end
05F6: ret 0

Use this line as a substitute for opcode 0A30. This can be placed anywhere within the external script:

5F5: call_scm_func @opcode_0A30 inputs 1 car_handle [car handle]  // change [car handle] to the actual handle of the car

Keywords

fix, repair, heal, vehicle, car, damage

External link