Difference between revisions of "0501"
Jump to navigation
Jump to search
m |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{OpCode | {{OpCode | ||
− | | | + | | games = {{Icon|VC}} {{Icon|SA}} |
+ | | command = SET_PLAYER_CAN_DO_DRIVE_BY | ||
| description = Sets the player's ability to perform a drive by | | description = Sets the player's ability to perform a drive by | ||
− | | | + | | syntax1 = 0501: set_player [''player handle''] drive_by_mode_enabled [''int''] |
− | | | + | | p1t = [''player handle''] |
− | | | + | | p1d = The [[0053|handle of the player]] |
+ | | p2t = [''int''] | ||
+ | | p2d = 0 = disable, {{hint|1|or any value other than 0}} = enable (default) | ||
| native = [[SET_PLAYER_CAN_DO_DRIVE_BY]] | | native = [[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 [[Saves (GTA SA)#Block 15: Player Info|block 15]] in San Andreas. |
+ | |||
+ | == Disassembled code == | ||
+ | This is disassembled code for this opcode from PC v1.0 US. | ||
+ | === Vice City === | ||
+ | <syntaxhighlight lang="nasm"> | ||
+ | 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 | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | == Keywords == | ||
set, toggle, player, drive-by, driveby | set, toggle, player, drive-by, driveby |
Latest revision as of 17:41, 24 May 2017
- 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