Difference between revisions of "0220"

From GTAMods Wiki
Jump to navigation Jump to search
 
Line 8: Line 8:
 
}}
 
}}
  
This conditional opcode returns true if the vehicle is armed with any [[0228#Bomb types|car bomb]].
+
This conditional opcode returns true if the vehicle is armed with any [[0228#Car bomb stages|car bomb]].
  
 
== For Vice City ==
 
== For Vice City ==
This opcode does not exist in Vice City but the type of the car bomb armed in a vehicle can still be retrieved. 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:
+
This opcode does not exist in Vice City but the stage of the car bomb armed in a vehicle can still be retrieved. 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:
<syntaxhighlight lang="scm">
+
{{Pre|class=sb-code|1=
:opcode_0220
+
<span class="nl">:opcode_0220</span>
// 0@ - input param (car handle)
+
<span class="c1">// 0@ - input param (car handle)</span>
05E7: 0@ = car 0@ struct
+
05E7: <span class="nv">0@</span> = car <span class="nv">0@</span> struct
0@ += 0x1FE  // car bomb offset
+
<span class="nv">0@</span> += <span class="m">0x1FE</span> <span class="c1">// car bomb offset</span>
05E0: 0@ = read_memory 0@ size 1 virtual_protect 0
+
05E0: <span class="nv">0@</span> = read_memory <span class="nv">0@</span> size <span class="m">1</span> virtual_protect <span class="m">0</span>
0B10: 0@ = 0@ AND 7 // requires CLEO plugins
+
05F9: <span class="nv">0@</span> = <span class="nv">0@</span> <span class="k">AND</span> <span class="m">7</span>
     0@ > 0  // check if has bomb
+
     <span class="nv">0@</span> &gt; <span class="m">0</span> <span class="c1">// check if has bomb</span>
05F6: ret 0
+
05F6: ret <span class="m">0</span>
</syntaxhighlight>
+
}}
  
 
Use this line as a substitute for opcode 0220. This can be placed anywhere within the external script as a conditional statement:
 
Use this line as a substitute for opcode 0220. This can be placed anywhere within the external script as a conditional statement:
<syntaxhighlight lang="scm">
+
{{Pre|class=sb-code|1=
// ...
+
<span class="c1">// ...</span>
if
+
<span class="k">if</span>
     05F5: call_scm_func @opcode_0220 inputs 1 car_handle [car_handle]
+
     05F5: call_scm_func <span class="nl">@opcode_0220</span> inputs <span class="m">1</span> car_handle [car_handle]
then
+
<span class="k">then</span>
     // [RETURNED TRUE]
+
     <span class="c1">// [RETURNED TRUE]</span>
else
+
<span class="k">else</span>
     // [RETURNED FALSE]
+
     <span class="c1">// [RETURNED FALSE]</span>
end
+
<span class="k">end</span>
// ...
+
<span class="c1">// ...</span>
</syntaxhighlight>
+
}}
  
 
== Keywords ==
 
== Keywords ==
check, car, vehicle, armed, has, any, bomb, status
+
check, car, vehicle, armed, has, any, bomb, status, stage
  
 
== See also ==
 
== See also ==
 
* {{Icon|3}} [[0228]], checks if the vehicle is armed with a specific bomb
 
* {{Icon|3}} [[0228]], checks if the vehicle is armed with a specific bomb
 
* {{Icon|3}} [[0242]], arms vehicle with bomb
 
* {{Icon|3}} [[0242]], arms vehicle with bomb

Latest revision as of 14:09, 8 December 2016

GTA III IS_CAR_ARMED_WITH_ANY_BOMB


Description
Checks if the vehicle is armed with any bomb
Syntax
0220:   car [car handle] has_car_bomb
Parameter
[car handle]
The handle of the vehicle

This conditional opcode returns true if the vehicle is armed with any car bomb.

For Vice City

This opcode does not exist in Vice City but the stage of the car bomb armed in a vehicle can still be retrieved. 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_0220
// 0@ - input param (car handle)
05E7: 0@ = car 0@ struct
0@ += 0x1FE  // car bomb offset
05E0: 0@ = read_memory 0@ size 1 virtual_protect 0
05F9: 0@ = 0@ AND 7
    0@ > 0  // check if has bomb
05F6: ret 0

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

// ...
if
    05F5: call_scm_func @opcode_0220 inputs 1 car_handle [car_handle]
then
    // [RETURNED TRUE]
else
    // [RETURNED FALSE]
end
// ...

Keywords

check, car, vehicle, armed, has, any, bomb, status, stage

See also

  • GTA III 0228, checks if the vehicle is armed with a specific bomb
  • GTA III 0242, arms vehicle with bomb