Difference between revisions of "0228"

From GTAMods Wiki
Jump to navigation Jump to search
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
{{Icon|3}} '''IS_CAR_ARMED_WITH_BOMB'''
+
{{OpCode
<hr />
+
| games      = {{Icon|3}}
<onlyinclude>{{#ifeq:{{{transcludesection|opcode}}}|opcode|
+
| command    = IS_CAR_ARMED_WITH_BOMB
'''Description'''
+
| description = Checks if the vehicle is armed with the bomb
: Checks current type of bomb armed in the vehicle
+
| syntax1    = 0228: &nbsp; car [''car handle''] bomb_status == [''int'']
'''Syntax'''
+
| p1t        = [''car handle'']
: 0228: &nbsp; car [''car handle''] bomb_status == [''int'']
+
| p1d        = The handle of the vehicle
'''Parameter'''
+
| p2t        = [''int'']
: [''car handle'']
+
| p2d        = Car bomb stage ([[#Car bomb stages|see below]])
:: The handle of the vehicle
+
}}
: [''int'']
 
:: [[#Bomb types|Bomb type]]
 
  
This conditional opcode returns true if the vehicle contains the current status type of the bomb.
+
This conditional opcode returns true if the vehicle is armed with the specified stage of car bomb.
}}</onlyinclude>
 
  
== Bomb types ==
+
== Car bomb stages ==
{| class="wikitable"
+
{|class="wikitable center-col-1"
! Type || Enum || Description
+
!Stage ||[[SCM language III/VC definitions#CARBOMB|Enum]] ||Description
 
|-
 
|-
| 0 || CARBOMB_NONE || No bomb
+
|0 ||CARBOMB_NONE ||No bomb
 
|-
 
|-
| 1 || CARBOMB_TIMED || Inactive timed bomb, can be obtained from [[garage]] type 2
+
|1 ||CARBOMB_TIMED ||Inactive timed bomb, can be obtained from [[garage]] type 2
 
|-
 
|-
| 2 || CARBOMB_ONIGNITION || Inactive ignition bomb, can be obtained from garage type 3
+
|2 ||CARBOMB_ONIGNITION ||Inactive ignition bomb, can be obtained from garage type 3
 
|-
 
|-
| 3 || CARBOMB_REMOTE || Remote detonation bomb, can be obtained from garage type 4
+
|3 ||CARBOMB_REMOTE ||Remote detonation bomb, can be obtained from garage type 4
 
|-
 
|-
| 4 || CARBOMB_TIMEDACTIVE || Active timed bomb, activated from bomb type 1
+
|4 ||CARBOMB_TIMEDACTIVE ||Active timed bomb, activated from bomb type 1
 
|-
 
|-
| 5 || CARBOMB_ONIGNITIONACTIVE || Active ignition bomb, activated from bomb type 2
+
|5 ||CARBOMB_ONIGNITIONACTIVE ||Active ignition bomb, activated from bomb type 2
 
|}
 
|}
  
 
== For Vice City ==
 
== For Vice City ==
This opcode does not exist in Vice City but the status of the car bomb 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.
+
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_0228
+
<span class="nl">:opcode_0228</span>
// 0@ - input param (car handle)
+
<span class="c1">// 0@ - input param (car handle)</span>
// 1@ - input param (bomb type)
+
<span class="c1">// 1@ - input param (bomb stage)</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>
0@ -= // subtract to reflect bomb type used in script
+
05F9: <span class="nv">0@</span> = <span class="nv">0@</span> <span class="k">AND</span> <span class="m">7</span>
if
+
003B:  <span class="nv">0@</span> == <span class="nv">1@</span> <span class="c1">// check bomb stage in car against input</span>
    003B:  0@ == 1@  // check bomb type in car against input
+
05F6: ret <span class="m">0</span>
then
+
}}
    0485: true
+
 
else
+
Use this line as a substitute for opcode 0228. This can be placed anywhere within the external script as a [[conditional statement]]:
    059A: false
+
{{Pre|class=sb-code|1=
end
+
<span class="c1">// ...</span>
05F6: ret 0
+
<span class="k">if</span>
</syntaxhighlight>
+
    05F5: call_scm_func <span class="nl">@opcode_0228</span> inputs <span class="m">2</span> car_handle [car handle] bomb_stage [int]
Use this line as a substitute for opcode 0228. This can be placed anywhere within the external script as a conditional statement.  
+
<span class="k">then</span>
<syntaxhighlight lang="scm">
+
    <span class="c1">// [RETURNED TRUE]</span>
05F5: call_scm_func @opcode_0228 inputs 2 car_handle [car handle] bomb_type [int] // change [car handle] to the actual handle of the car
+
<span class="k">else</span>
</syntaxhighlight>
+
    <span class="c1">// [RETURNED FALSE]</span>
 +
<span class="k">end</span>
 +
<span class="c1">// ...</span>
 +
}}
  
 
== Keywords ==
 
== Keywords ==
check, car, vehicle, bomb, status
+
check, car, vehicle, armed, bomb, status, stage
  
 
== See also ==
 
== See also ==
* [[0242]], arms the car with the type of bomb
+
* {{Icon|3}} [[0220]], checks if the vehicle is armed with any bomb
 
+
* {{Icon|3}} [[0242]], arms car with bomb
[[Category:OpCodes]]
 
[[Category:Code Snippets]]
 

Latest revision as of 13:52, 8 December 2016

GTA III IS_CAR_ARMED_WITH_BOMB


Description
Checks if the vehicle is armed with the bomb
Syntax
0228:   car [car handle] bomb_status == [int]
Parameter
[car handle]
The handle of the vehicle
[int]
Car bomb stage (see below)

This conditional opcode returns true if the vehicle is armed with the specified stage of car bomb.

Car bomb stages

Stage Enum Description
0 CARBOMB_NONE No bomb
1 CARBOMB_TIMED Inactive timed bomb, can be obtained from garage type 2
2 CARBOMB_ONIGNITION Inactive ignition bomb, can be obtained from garage type 3
3 CARBOMB_REMOTE Remote detonation bomb, can be obtained from garage type 4
4 CARBOMB_TIMEDACTIVE Active timed bomb, activated from bomb type 1
5 CARBOMB_ONIGNITIONACTIVE Active ignition bomb, activated from bomb type 2

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_0228
// 0@ - input param (car handle)
// 1@ - input param (bomb stage)
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
003B:   0@ == 1@  // check bomb stage in car against input
05F6: ret 0

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

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

Keywords

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

See also

  • GTA III 0220, checks if the vehicle is armed with any bomb
  • GTA III 0242, arms car with bomb