Difference between revisions of "0330"

From GTAMods Wiki
Jump to navigation Jump to search
m
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
__NOTOC__
 
{{OpCode
 
{{OpCode
| ini        = 0330=2,%1d% %2d%
+
| games      = {{Icon|t}}
 +
| command    = SET_PLAYER_NEVER_GETS_TIRED
 
| description = Sets the player to sprint without tiring
 
| description = Sets the player to sprint without tiring
| p1          = Player handle
+
| syntax1    = 0330: set_player [''player handle''] infinite_run_to [''int'']
| p2          = Flag
+
| p1t        = [''player handle'']
| game        = GTA3, Vice City, San Andreas
+
| p1d        = The [[0053|handle of the player]]
 +
| p2t        = [''int'']
 +
| p2d        = 0 = disable (default), {{hint|1|or any value other than 0}} = enable
 
| native      = [[SET_PLAYER_NEVER_GETS_TIRED]]
 
| native      = [[SET_PLAYER_NEVER_GETS_TIRED]]
 
}}
 
}}
This opcode sets the player's ability to sprint without tiring out.
 
  
==Flags==
+
This opcode sets the player's ability to sprint without tiring out. 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 [[Saves (GTA SA)#Block 15: Player Info|block 15]] in San Andreas.
'''Flag 0''': Disables infinite run<br>
 
'''Flag 1''': Enables infinite run
 
  
==Keywords==
+
== Disassembled code ==
set, toggle, infinite, run, sprint
+
These are disassembled code for this opcode both from PC v1.0 US.
 +
=== GTA III ===
 +
<syntaxhighlight lang="nasm">
 +
loc_448C37:
 +
    mov    eax, [esp+398h+var_388]
 +
    mov    ecx, [esp+398h+var_388]          ; get address of script for thiscall
 +
    add    eax, 10h                          ; get address of script's current instruction pointer
 +
    push    2                                ; push 2 for two parameters to collect
 +
    push    eax                              ; push address of script's current instruction pointer
 +
    call    CRunningScript::CollectParameters ; call CRunningScript::CollectParameters(uint *,short)
 +
    mov    eax, ds:ScriptParams[0]          ; get value of first parameter, the player handle
 +
    imul    eax, 13Ch
 +
    add    eax, offset CWorld::Players      ; get address of the player at CWorld::Players + player handle * 0x13C
 +
    cmp    ds:ScriptParams[1], 0            ; check whether or not value of second parameter is 0
 +
    jz      short loc_448C70
 +
    mov    byte ptr [eax+114h], 1            ; offset player address by 0x114 and set to enable infinite run
 +
    jmp    short loc_448C77
 +
    align 10h
 +
loc_448C70:
 +
    mov    byte ptr [eax+114h], 0            ; offset player address by 0x114 and set to disable infinite run
 +
loc_448C77:
 +
    lea    ecx, [esp+398h+var_258]
 +
    call    CMatrix::~CMatrix
 +
    xor    al, al                            ; return 0
 +
</syntaxhighlight>
 +
 
 +
=== Vice City ===
 +
<syntaxhighlight lang="nasm">
 +
loc_45B950:
 +
    mov    eax, [esp+2D0h+var_2B8]
 +
    mov    ecx, [esp+2D0h+var_2B8]          ; get address of script for thiscall
 +
    add    eax, 10h                          ; get address of script's current instruction pointer
 +
    push    2                                ; push 2 for two parameters to collect
 +
    push    eax                              ; push address of script's current instruction pointer
 +
    call    CRunningScript::CollectParameters ; call CRunningScript::CollectParameters(uint *,short)
 +
    mov    eax, ds:ScriptParams[0]          ; get value of first parameter, the player handle
 +
    imul    eax, 170h
 +
    add    eax, offset CWorld::Players      ; get address of the player at CWorld::Players + player handle * 0x170
 +
    cmp    ds:ScriptParams[1], 0            ; check whether or not value of second parameter is 0
 +
    jz      short loc_45B985
 +
    mov    byte ptr [eax+140h], 1            ; offset player address by 0x140 and set to enable infinite run
 +
    jmp    short loc_45B98C
 +
loc_45B985:
 +
    mov    byte ptr [eax+140h], 0            ; offset player address by 0x140 and set to disable infinite run
 +
loc_45B98C:
 +
    lea    ecx, [esp+2D0h+var_1B0]
 +
    call    CMatrix::~CMatrix
 +
    xor    al, al                            ; return 0
 +
</syntaxhighlight>
 +
 
 +
== Keywords ==
 +
set, toggle, player, infinite, run, sprint, never gets tired

Latest revision as of 17:37, 24 May 2017

GTA III Vice City San Andreas SET_PLAYER_NEVER_GETS_TIRED


Description
Sets the player to sprint without tiring
Syntax
0330: set_player [player handle] infinite_run_to [int]
Parameter
[player handle]
The handle of the player
[int]
0 = disable (default), 1 = enable
Native analog
SET_PLAYER_NEVER_GETS_TIRED

This opcode sets the player's ability to sprint without tiring out. The value set with this opcode is saved in block 16 of the save file in GTA III, block 18 in Vice City, and block 15 in San Andreas.

Disassembled code

These are disassembled code for this opcode both from PC v1.0 US.

GTA III

loc_448C37:
    mov     eax, [esp+398h+var_388]
    mov     ecx, [esp+398h+var_388]           ; get address of script for thiscall
    add     eax, 10h                          ; get address of script's current instruction pointer
    push    2                                 ; push 2 for two parameters to collect
    push    eax                               ; push address of script's current instruction pointer
    call    CRunningScript::CollectParameters ; call CRunningScript::CollectParameters(uint *,short)
    mov     eax, ds:ScriptParams[0]           ; get value of first parameter, the player handle
    imul    eax, 13Ch
    add     eax, offset CWorld::Players       ; get address of the player at CWorld::Players + player handle * 0x13C
    cmp     ds:ScriptParams[1], 0             ; check whether or not value of second parameter is 0
    jz      short loc_448C70
    mov     byte ptr [eax+114h], 1            ; offset player address by 0x114 and set to enable infinite run
    jmp     short loc_448C77
    align 10h
loc_448C70:
    mov     byte ptr [eax+114h], 0            ; offset player address by 0x114 and set to disable infinite run
loc_448C77:
    lea     ecx, [esp+398h+var_258]
    call    CMatrix::~CMatrix
    xor     al, al                            ; return 0

Vice City

loc_45B950:
    mov     eax, [esp+2D0h+var_2B8]
    mov     ecx, [esp+2D0h+var_2B8]           ; get address of script for thiscall
    add     eax, 10h                          ; get address of script's current instruction pointer
    push    2                                 ; push 2 for two parameters to collect
    push    eax                               ; push address of script's current instruction pointer
    call    CRunningScript::CollectParameters ; call CRunningScript::CollectParameters(uint *,short)
    mov     eax, ds:ScriptParams[0]           ; get value of first parameter, the player handle
    imul    eax, 170h
    add     eax, offset CWorld::Players       ; get address of the player at CWorld::Players + player handle * 0x170
    cmp     ds:ScriptParams[1], 0             ; check whether or not value of second parameter is 0
    jz      short loc_45B985
    mov     byte ptr [eax+140h], 1            ; offset player address by 0x140 and set to enable infinite run
    jmp     short loc_45B98C
loc_45B985:
    mov     byte ptr [eax+140h], 0            ; offset player address by 0x140 and set to disable infinite run
loc_45B98C:
    lea     ecx, [esp+2D0h+var_1B0]
    call    CMatrix::~CMatrix
    xor     al, al                            ; return 0

Keywords

set, toggle, player, infinite, run, sprint, never gets tired