0501
Jump to navigation
Jump to search
- 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