Difference between revisions of "0414"

From GTAMods Wiki
Jump to navigation Jump to search
(disassembly)
Line 1: Line 1:
{{Icon|trilogy}}
+
{{Icon|trilogy}} '''SET_FREE_HEALTH_CARE'''
 
<hr />
 
<hr />
 
'''Description'''
 
'''Description'''
: Enables a free treatment for the player
+
: Enables a free hospital visit for the player
 
'''Syntax'''
 
'''Syntax'''
 
: 0414: set_player [''player handle''] single_free_treatment [''int'']
 
: 0414: set_player [''player handle''] single_free_treatment [''int'']
Line 9: Line 9:
 
:: The [[0053|handle of the player]]
 
:: The [[0053|handle of the player]]
 
: [''int'']
 
: [''int'']
:: 0 = disable free treatment, {{hint|1|or any value other than 0}} = enable free treatment
+
:: 0 = disable (default), {{hint|1|or any value other than 0}} = enable
 
'''Native analog'''
 
'''Native analog'''
 
: [[SET_FREE_HEALTH_CARE]]
 
: [[SET_FREE_HEALTH_CARE]]
  
This opcode sets a free treatment for the player. When enabled, if the player is wasted, he will not lose any weapons or cash after respawning. The free treatment works once only, so to allow free treatment again, you have to enable it through this opcode again. This opcode was unused in GTA III in the default script.  
+
This opcode sets a free hospital visit for the player. When enabled, if the player is wasted, he will not lose any weapons or cash after respawning. The free treatment works once only, so to allow free treatment again, you have to enable it through this opcode again. This opcode was unused in GTA III's original script. 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, [[Saves (GTA VC)#Block 18: Player Info|block 18]] in Vice City, and in [[Saves_(GTA_SA)#Block_15:_Player_data|block 15]] in San Andreas.
  
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, [[Saves (GTA VC)#Block 18: Player Info|block 18]] in Vice City and in [[Saves_(GTA_SA)#Block_15:_Player_data|block 15]] in San Andreas.
+
== Disassembled code ==
 +
This is disassembled code for this opcode from v1.0 US.
 +
=== Vice City ===
 +
<syntaxhighlight lang="asm" style="overflow-x: auto;">
 +
; call subroutine to collect values from input parameters
 +
.text:00608BCE                lea    eax, [ebx+10h]
 +
.text:00608BD1                mov    ecx, ebx
 +
.text:00608BD3                push    2  ; two parameters to collect
 +
.text:00608BD5                push    eax
 +
.text:00608BD6                call    CRunningScript__CollectParameters
 +
; read collected content
 +
.text:00608BDB                mov    eax, ds:_opcodeParameter1
 +
.text:00608BE0                imul    eax, 170h
 +
.text:00608BE6                add    eax, offset _playerInfo  ; address of the player info
 +
.text:00608BEB                cmp    ds:_opcodeParameter2, 0  ; check whether or not parameter 2 is set to 0
 +
.text:00608BF2                jz      short loc_608C00
 +
.text:00608BF4                mov    byte ptr [eax+146h], 1  ; offset 0x146 set to enable free treatment
 +
.text:00608BFB                jmp    short loc_608C07
 +
.text:00608BFD                align 10h
 +
.text:00608C00 loc_608C00:    mov    byte ptr [eax+146h], 0  ; offset 0x146 set to disable free treatment
 +
; end
 +
.text:00608C07 loc_608C07:    xor    al, al
 +
.text:00608C09                add    esp, 70h
 +
.text:00608C0C                pop    ebp
 +
.text:00608C0D                pop    edi
 +
.text:00608C0E                pop    esi
 +
.text:00608C0F                pop    ebx
 +
.text:00608C10                retn    4
 +
</syntaxhighlight>
  
 
== Keywords ==
 
== Keywords ==

Revision as of 18:42, 16 April 2015

GTA III Vice City San Andreas SET_FREE_HEALTH_CARE


Description

Enables a free hospital visit for the player

Syntax

0414: set_player [player handle] single_free_treatment [int]

Parameter

[player handle]
The handle of the player
[int]
0 = disable (default), 1 = enable

Native analog

SET_FREE_HEALTH_CARE

This opcode sets a free hospital visit for the player. When enabled, if the player is wasted, he will not lose any weapons or cash after respawning. The free treatment works once only, so to allow free treatment again, you have to enable it through this opcode again. This opcode was unused in GTA III's original script. The value set with this opcode is saved in block 16 of the save file in GTA III, block 18 in Vice City, and in block 15 in San Andreas.

Disassembled code

This is disassembled code for this opcode from v1.0 US.

Vice City

; call subroutine to collect values from input parameters
.text:00608BCE                 lea     eax, [ebx+10h]
.text:00608BD1                 mov     ecx, ebx
.text:00608BD3                 push    2  ; two parameters to collect
.text:00608BD5                 push    eax
.text:00608BD6                 call    CRunningScript__CollectParameters
; read collected content
.text:00608BDB                 mov     eax, ds:_opcodeParameter1
.text:00608BE0                 imul    eax, 170h
.text:00608BE6                 add     eax, offset _playerInfo  ; address of the player info
.text:00608BEB                 cmp     ds:_opcodeParameter2, 0  ; check whether or not parameter 2 is set to 0
.text:00608BF2                 jz      short loc_608C00
.text:00608BF4                 mov     byte ptr [eax+146h], 1  ; offset 0x146 set to enable free treatment
.text:00608BFB                 jmp     short loc_608C07
.text:00608BFD                 align 10h
.text:00608C00 loc_608C00:     mov     byte ptr [eax+146h], 0  ; offset 0x146 set to disable free treatment
; end
.text:00608C07 loc_608C07:     xor     al, al
.text:00608C09                 add     esp, 70h
.text:00608C0C                 pop     ebp
.text:00608C0D                 pop     edi
.text:00608C0E                 pop     esi
.text:00608C0F                 pop     ebx
.text:00608C10                 retn    4

Keywords

set, toggle, player, free, treatment, hospital, wasted