Difference between revisions of "0501"

From GTAMods Wiki
Jump to navigation Jump to search
(page updates + disassembly)
Line 1: Line 1:
{{OpCode
+
{{Icon|VC}} {{Icon|SA}} '''SET_PLAYER_CAN_DO_DRIVE_BY'''
| ini        = 0501=2,%1d% %2d%
+
<hr />
| description = Sets the player's ability to perform a drive by
+
'''Description'''
| p1          = Player handle
+
: Sets the player's ability to perform a drive by
| p2          = Flag (0 = disable, 1 = enable)
+
'''Syntax'''
| game        = [[Vice City]], [[San Andreas]]
+
: 0501: set_player [''player handle''] drive_by_mode_enabled [''int'']
| native      = [[SET_PLAYER_CAN_DO_DRIVE_BY]]
+
'''Parameter'''
}}
+
: [''player handle'']
This opcode can be used to disable the ability to perform a drive by.
+
:: [[0053|The handle of the player]]
 +
: [''int'']
 +
:: 0 = disable, {{hint|1|or any value other than 0}} = enable (default)
 +
'''Native analog'''
 +
: [[SET_PLAYER_CAN_DO_DRIVE_BY]]
  
==Keywords==
+
This opcode sets the player's ability to perform drive-bys (shooting out of vehicles). The value set with this opcode is saved in [[Saves (GTA VC)#Block 18: Player Info|block 18 of the save file]] 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:006320D0                lea    eax, [ebp+10h]
 +
.text:006320D3                mov    ecx, ebp
 +
.text:006320D5                push    2  ; two parameters to collect
 +
.text:006320D7                push    eax
 +
.text:006320D8                call    CRunningScript__CollectParameters
 +
; read collected content
 +
.text:006320DD                mov    eax, ds:_opcodeParameter1
 +
.text:006320E2                imul    eax, 170h
 +
.text:006320E8                add    eax, offset _playerInfo  ; address of the player info
 +
.text:006320ED                cmp    ds:_opcodeParameter2, 0  ; check whether or not parameter 2 is set to 0
 +
.text:006320F4                jz      short loc_632100
 +
.text:006320F6                mov    byte ptr [eax+147h], 1  ; offset 0x147 set to enable drive by
 +
.text:006320FD                jmp    short loc_632107
 +
.text:006320FF                align 10h
 +
.text:00632100 loc_632100:    mov    byte ptr [eax+147h], 0  ; offset 0x147 set to disable drive by
 +
; end
 +
.text:00632107 loc_632107:    xor    al, al
 +
.text:00632109                add    esp, 1B0h
 +
.text:0063210F                pop    ebp
 +
.text:00632110                pop    edi
 +
.text:00632111                pop    esi
 +
.text:00632112                pop    ebx
 +
.text:00632113                retn    4
 +
</syntaxhighlight>
 +
 
 +
== Keywords ==
 
set, toggle, player, drive-by, driveby
 
set, toggle, player, drive-by, driveby
 +
 +
[[Category:OpCodes]]

Revision as of 17:34, 16 April 2015

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 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:006320D0                 lea     eax, [ebp+10h]
.text:006320D3                 mov     ecx, ebp
.text:006320D5                 push    2  ; two parameters to collect
.text:006320D7                 push    eax
.text:006320D8                 call    CRunningScript__CollectParameters
; read collected content
.text:006320DD                 mov     eax, ds:_opcodeParameter1
.text:006320E2                 imul    eax, 170h
.text:006320E8                 add     eax, offset _playerInfo  ; address of the player info
.text:006320ED                 cmp     ds:_opcodeParameter2, 0  ; check whether or not parameter 2 is set to 0
.text:006320F4                 jz      short loc_632100
.text:006320F6                 mov     byte ptr [eax+147h], 1  ; offset 0x147 set to enable drive by
.text:006320FD                 jmp     short loc_632107
.text:006320FF                 align 10h
.text:00632100 loc_632100:     mov     byte ptr [eax+147h], 0  ; offset 0x147 set to disable drive by
; end
.text:00632107 loc_632107:     xor     al, al
.text:00632109                 add     esp, 1B0h
.text:0063210F                 pop     ebp
.text:00632110                 pop     edi
.text:00632111                 pop     esi
.text:00632112                 pop     ebx
.text:00632113                 retn    4

Keywords

set, toggle, player, drive-by, driveby