Difference between revisions of "0945"

From GTAMods Wiki
Jump to navigation Jump to search
m
(highlight)
 
Line 1: Line 1:
{{Icon|SA}} '''GET_PLAYER_MAX_ARMOUR'''
+
{{OpCode
<hr />
+
| games      = {{Icon|SA}}
'''Description'''
+
| command    = GET_PLAYER_MAX_ARMOUR
: Gets the player's maximum armour
+
| description = Gets the player's maximum armour
'''Syntax'''
+
| syntax1    = 0945: get_player [''player handle''] max_armour_to [''var'']
: 0945: get_player [''player handle''] max_armour_to [''var'']
+
| p1t        = [''player handle'']
'''Parameter'''
+
| p1d        = The [[0053|handle of the player]]
: [''player handle'']
+
| p2t        = [''var'']
:: The handle of the player
+
| p2d        = Variable to store the integer value
: [''var'']
+
}}
:: Variable to store the integer value
 
  
 
== For Vice City ==
 
== For Vice City ==
 
This opcode does not exist in Vice City but it is possible to get the player's max armour. 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 possible to get the player's max armour. 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_0945
+
<span class="nl">:opcode_0945</span>
// 0@ - input param (player handle)
+
<span class="c1">// 0@ - input param (player handle)</span>
0@ *= 368
+
<span class="nv">0@</span> *= <span class="m">0x170</span>  <span class="c1">// size of each player info struct</span>
0@ += 0x94AD28
+
<span class="nv">0@</span> += <span class="m">0x94AD28</span>  <span class="c1">// base address for player info</span>
0@ += 0x144
+
<span class="nv">0@</span> += <span class="m">0x144</span>  <span class="c1">// get max armour 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>
05F6: ret 1 0@
+
05F6: ret <span class="m">1</span> <span class="nv">0@</span>
</syntaxhighlight>
+
}}
 +
 
 
Use this line as a substitute for opcode 0945. This can be placed anywhere within the external script:
 
Use this line as a substitute for opcode 0945. This can be placed anywhere within the external script:
<source lang="scm">
+
{{Pre|class=sb-code|1=
05F5: call_scm_func @opcode_0945 inputs 1 player_handle [player handle] store_to [var]
+
05F5: call_scm_func <span class="nl">@opcode_0945</span> inputs <span class="m">1</span> player_handle [player handle] store_to [<span class="k">var</span>]
</source>
+
}}
  
 
== Keywords ==
 
== Keywords ==
 
get, store, player, max, maximum, armor, armour
 
get, store, player, max, maximum, armor, armour
  
[[Category:OpCodes]]
 
 
[[Category:Code Snippets]]
 
[[Category:Code Snippets]]

Latest revision as of 02:37, 4 December 2016

San Andreas GET_PLAYER_MAX_ARMOUR


Description
Gets the player's maximum armour
Syntax
0945: get_player [player handle] max_armour_to [var]
Parameter
[player handle]
The handle of the player
[var]
Variable to store the integer value

For Vice City

This opcode does not exist in Vice City but it is possible to get the player's max armour. 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_0945
// 0@ - input param (player handle)
0@ *= 0x170  // size of each player info struct
0@ += 0x94AD28  // base address for player info
0@ += 0x144  // get max armour offset
05E0: 0@ = read_memory 0@ size 1 virtual_protect 0
05F6: ret 1 0@

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

05F5: call_scm_func @opcode_0945 inputs 1 player_handle [player handle] store_to [var]

Keywords

get, store, player, max, maximum, armor, armour