Difference between revisions of "0501"

From GTAMods Wiki
Jump to navigation Jump to search
m
 
Line 16: Line 16:
 
This is disassembled code for this opcode from PC v1.0 US.
 
This is disassembled code for this opcode from PC v1.0 US.
 
=== Vice City ===
 
=== Vice City ===
<syntaxhighlight lang="nasm" style="overflow-x: auto;">
+
<syntaxhighlight lang="nasm">
 
loc_6320D0:
 
loc_6320D0:
 
     lea    eax, [ebp+10h]                    ; get address of script's current instruction pointer
 
     lea    eax, [ebp+10h]                    ; get address of script's current instruction pointer
     mov    ecx, ebp                          ; get CRunningScript pointer for thiscall
+
     mov    ecx, ebp                          ; get address of script for thiscall
 
     push    2                                ; push 2 for two parameters to collect
 
     push    2                                ; push 2 for two parameters to collect
 
     push    eax                              ; push address of script's current instruction pointer
 
     push    eax                              ; push address of script's current instruction pointer
     call    CRunningScript::CollectParameters ; call CRunningScript::CollectParameters
+
     call    CRunningScript::CollectParameters ; call CRunningScript::CollectParameters(uint *,short)
 
     mov    eax, ds:ScriptParams[0]          ; get value of first parameter, the player handle
 
     mov    eax, ds:ScriptParams[0]          ; get value of first parameter, the player handle
 
     imul    eax, 170h
 
     imul    eax, 170h

Latest revision as of 17:41, 24 May 2017

Vice City San Andreas SET_PLAYER_CAN_DO_DRIVE_BY


Description
Sets the player's ability to perform a drive by
Syntax
0501: set_player [player handle] drive_by_mode_enabled [int]
Parameter
[player handle]
The handle of the player
[int]
0 = disable, 1 = enable (default)
Native analog
SET_PLAYER_CAN_DO_DRIVE_BY

This opcode sets the player's ability to perform drive-bys (shooting out of vehicles). The value set with this opcode is saved in block 18 of the save file in Vice City and block 15 in San Andreas.

Disassembled code

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

Vice City

loc_6320D0:
    lea     eax, [ebp+10h]                    ; get address of script's current instruction pointer
    mov     ecx, ebp                          ; get address of script for thiscall
    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_632100
    mov     byte ptr [eax+147h], 1            ; offset player address by 0x147 and set to can do drive by
    jmp     short loc_632107
    align 10h
loc_632100:
    mov     byte ptr [eax+147h], 0            ; offset player address by 0x147 and set to cannot do drive by
loc_632107:
    xor     al, al                            ; return 0

Keywords

set, toggle, player, drive-by, driveby