getVehicleDoorState | Multi Theft Auto: Wiki Skip to content

getVehicleDoorState

Client-side
Server-side
Shared

Pair: setVehicleDoorState

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function returns the current state of the specifed door on the vehicle.

OOP Syntax Help! I don't understand this!

Syntax

int getVehicleDoorState ( vehicle theVehicle, int door )
Required Arguments
  • theVehicle: MISSING_PARAM_DESC
  • door: MISSING_PARAM_DESC

Returns

  • int: value

If successful, one of the following integers will be returned:

Code Examples

shared

This example implements a doesVehicleHaveDoorOpen() function, that returns true if any of the doors on a vehicle are open.

function doesVehicleHaveDoorOpen(vehicle)
local isDoorAjar = false
for i=0,5 do
local doorState = getVehicleDoorState(vehicle, i)
if doorState == 1 or doorState == 3 or doorState == 4 then
isDoorAjar = true
end
end
return isDoorAjar
end

See Also

Vehicle Functions