Difference between revisions of "0130"

From GTAMods Wiki
Jump to navigation Jump to search
(Created page with "{{Icon|3}} '''HAS_PLAYER_BEEN_ARRESTED''' <hr /> '''Description''' : Checks if the player is arrested '''Syntax''' : 0130:   player [''player handle''] busted '''Paramete...")
 
m
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{Icon|3}} '''HAS_PLAYER_BEEN_ARRESTED'''
+
{{OpCode
<hr />
+
| games      = {{Icon|3}}
'''Description'''
+
| command    = HAS_PLAYER_BEEN_ARRESTED
: Checks if the player is arrested
+
| description = Checks if the player is arrested
'''Syntax'''
+
| syntax1    = 0130: &nbsp; player [''player handle''] busted
: 0130: &nbsp; player [''player handle''] busted
+
| p1t        = [''player handle'']
'''Parameter'''
+
| p1d        = The [[0053|handle of the player]]
: [''player handle'']
+
}}
:: The [[0053|handle of the player]]
 
  
 
This conditional opcode returns true if the busted screen pops up.
 
This conditional opcode returns true if the busted screen pops up.
Line 13: Line 12:
 
== For Vice City ==
 
== For Vice City ==
 
This opcode does not exist in Vice City but it is still possible to check if the player is busted. 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 it is still possible to check if the player is busted. 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_0130
+
<span class="nl">:opcode_0130</span>
0@ *= 0x170
+
<span class="c1">// 0@ - input param (player handle)</span>
0@ += 0x94ADF4 // wasted/busted status
+
<span class="nv">0@</span> *= <span class="m">0x170</span>  <span class="c1">// size of each player info struct</span>
05E0: 0@ = read_memory 0@ size 1 virtual_protect 0  // read status
+
<span class="nv">0@</span> += <span class="m">0x94AD28</span>  <span class="c1">// base address for player info</span>
     0@ == 2  // is busted
+
<span class="nv">0@</span> += <span class="m">0xCC</span> <span class="c1">// wasted/busted status offset</span>
05F6: ret 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> <span class="c1">// read status</span>
</syntaxhighlight>
+
     <span class="nv">0@</span> == <span class="m">2</span> <span class="c1">// is busted</span>
 +
05F6: ret <span class="m">0</span>
 +
}}
  
 
Use this line as a substitute for opcode 03C9. This can be placed anywhere within the external script as a conditional statement.
 
Use this line as a substitute for opcode 03C9. 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_0130 inputs 1 player_handle [player_handle]
+
     05F5: call_scm_func <span class="nl">@opcode_0130</span> inputs <span class="m">1</span> player_handle [player_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 ==
Line 39: Line 40:
  
 
== See also ==
 
== See also ==
* [[0256]], checks if the player is wasted or busted
+
* {{Icon|t}} [[0256]], checks if the player is playing
 
 
[[Category:OpCodes]]
 

Latest revision as of 21:20, 26 November 2016

GTA III HAS_PLAYER_BEEN_ARRESTED


Description
Checks if the player is arrested
Syntax
0130:   player [player handle] busted
Parameter
[player handle]
The handle of the player

This conditional opcode returns true if the busted screen pops up.

For Vice City

This opcode does not exist in Vice City but it is still possible to check if the player is busted. 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_0130
// 0@ - input param (player handle)
0@ *= 0x170  // size of each player info struct
0@ += 0x94AD28  // base address for player info
0@ += 0xCC  // wasted/busted status offset
05E0: 0@ = read_memory 0@ size 1 virtual_protect 0  // read status
    0@ == 2  // is busted
05F6: ret 0

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

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

Keywords

check, player, busted, arrested

See also

  • GTA III Vice City San Andreas 0256, checks if the player is playing