Difference between revisions of "0413"

From GTAMods Wiki
Jump to navigation Jump to search
(Created page with '{{Icon|3}} '''SET_GET_OUT_OF_JAIL_FREE''' <hr /> <onlyinclude>{{#ifeq:{{{transcludesection|opcode}}}|opcode| '''Description''' : Enables get out of jail free for the player '''Sy…')
 
(highlight)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Icon|3}} '''SET_GET_OUT_OF_JAIL_FREE'''
+
{{OpCode
<hr />
+
| games      = {{Icon|3}}
<onlyinclude>{{#ifeq:{{{transcludesection|opcode}}}|opcode|
+
| command    = SET_GET_OUT_OF_JAIL_FREE
'''Description'''
+
| description = Sets get out of jail free for the player
: Enables get out of jail free for the player
+
| syntax1    = 0413: set_player [''player handle''] get_<wbr>out_<wbr>of_<wbr>jail_<wbr>free [''int'']
'''Syntax'''
+
| p1t        = [''player handle'']
: 0413: set_player [''player handle''] get_out_of_jail_free [''int'']
+
| p1d        = The [[0053|handle of the player]]
'''Parameter'''
+
| p2t        = [''int'']
: [''player handle'']
+
| p2d        = 0 = disable out of jail free (default), {{hint|1|or any value other than 0}} = enable out of jail free
:: The [[0053|handle of the player]]
+
}}
: [''int'']
 
:: 0 = disable out of jail free, {{hint|1|or any value other than 0}} = enable out of jail free
 
  
This opcode sets get out of jail free for the player. When enabled, if the player is busted, he will not lose any cash after respawning, but weapons will still be removed. The get out of jail free works once only, so to allow this again, you have to enable it through this opcode again.
+
This opcode sets get out of jail free for the player. When enabled, if the player is busted, you will not lose any cash after respawning but weapons will still be removed. The get out of jail free works once only, so to allow this effect again you have to enable it through this opcode again. The value set with this opcode is saved in [[Saves (GTA 3)#Block 16: Player Info|block 16 of the save file]] in GTA III. Although the opcode does not exist in Vice City and San Andreas, the behavior still exists and can be enabled through other means.
}}</onlyinclude>
 
  
 
== For Vice City ==
 
== For Vice City ==
This opcode does not exist in Vice City, but the function that controls the busted sequence still contains this feature. 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:
+
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:
<source lang="scm">
+
{{Pre|class=sb-code|1=
:opcode_0413
+
<span class="nl">:opcode_0413</span>
// 0@ - input param (placeholder)
+
<span class="c1">// 0@ - input param (player handle)</span>
// 1@ - input param (flag)
+
<span class="c1">// 1@ - input param (set)</span>
0@ = 0x94AD28
+
<span class="nv">0@</span> *= <span class="m">0x170</span>  <span class="c1">// size of each player info struct</span>
0@ += 0x145
+
<span class="nv">0@</span> += <span class="m">0x94AD28</span>  <span class="c1">// base address for player info</span>
05DF: write_memory 0@ size 1 value 1@ virtual_protect 0
+
<span class="nv">0@</span> += <span class="m">0x145</span>  <span class="c1">// get out of jail free offset</span>
05F6: ret 0
+
05DF: write_memory <span class="nv">0@</span> size <span class="m">1</span> value <span class="nv">1@</span> virtual_protect <span class="m">0</span>
</source>
+
05F6: ret <span class="m">0</span>
 +
}}
 +
 
 
Use this line as a substitute for opcode 0413. This can be placed anywhere within the external script:
 
Use this line as a substitute for opcode 0413. This can be placed anywhere within the external script:
<source lang="scm">
+
{{Pre|class=sb-code|1=
05F5: call_scm_func @opcode_0413 inputs 2 player_handle [player handle] get_out_of_jail_free [int]
+
05F5: call_scm_func <span class="nl">@opcode_0413</span> inputs <span class="m">2</span> player_handle [player handle] get_out_of_jail_free [int]
// change [player handle] to the actual handle of the player, i.e. $PLAYER_CHAR, and change [int] to a flag
+
}}
</source>
+
The value set using this technique is saved in [[Saves (GTA VC)#Block 18: Player Info|block 18 of the save file]] in Vice City.
  
 
== Keywords ==
 
== Keywords ==
set, toggle, player, free, prison, police, busted
+
set, toggle, player, get, out, free, prison, jail, police, busted
 
 
[[Category:OpCodes]][[Category:Code Snippets]]
 

Latest revision as of 21:26, 26 November 2016

GTA III SET_GET_OUT_OF_JAIL_FREE


Description
Sets get out of jail free for the player
Syntax
0413: set_player [player handle] get_out_of_jail_free [int]
Parameter
[player handle]
The handle of the player
[int]
0 = disable out of jail free (default), 1 = enable out of jail free

This opcode sets get out of jail free for the player. When enabled, if the player is busted, you will not lose any cash after respawning but weapons will still be removed. The get out of jail free works once only, so to allow this effect again you have to enable it through this opcode again. The value set with this opcode is saved in block 16 of the save file in GTA III. Although the opcode does not exist in Vice City and San Andreas, the behavior still exists and can be enabled through other means.

For Vice City

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_0413
// 0@ - input param (player handle)
// 1@ - input param (set)
0@ *= 0x170  // size of each player info struct
0@ += 0x94AD28  // base address for player info
0@ += 0x145  // get out of jail free offset
05DF: write_memory 0@ size 1 value 1@ virtual_protect 0
05F6: ret 0

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

05F5: call_scm_func @opcode_0413 inputs 2 player_handle [player handle] get_out_of_jail_free [int]

The value set using this technique is saved in block 18 of the save file in Vice City.

Keywords

set, toggle, player, get, out, free, prison, jail, police, busted