# getVehicleDoorState (Shared)

> Returns the state of one or more doors of a vehicle.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Shared
- **Category**: Vehicles
- **URL**: https://wiki.mymp.gg/en/getVehicleDoorState

## Syntax

```lua
int|table|false getVehicleDoorState(vehicle vehicle, int|string|table door)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `vehicle` | `vehicle` | The vehicle. |
| `door` | `int\|string\|table` | Which door: its number (0 the front lid, 1 the rear lid, 2 and 3 the front doors on the driver's and the passenger's side, 4 and 5 the rear ones), its frame name (`door_dside_f`; `left` and `right` in place of `dside` and `pside` follow the vehicle's driving side), a group (`all`, `side_doors`, `front_doors`, `rear_doors`, `left_doors`, `right_doors`), `-1` for all of them or a table of several. |

## Returns

The state (0 shut, 1 open, 2 shut and damaged, 3 open and damaged, 4 missing). When several doors were asked for (a group, `-1` or a table), a table of frame name → value. `false` if the vehicle lacks one of the doors named.

## Example

```lua
addCommandHandler("portas", function(player)
    local vehicle = getPedOccupiedVehicle(player)
    if not vehicle then return end
    local states = getVehicleDoorState(vehicle, "all")
    for frame, state in pairs(states) do
        outputDebugString(frame .. ": " .. state)
    end
end)
```

## See also

- [setVehicleDoorState (Shared)](https://wiki.mymp.gg/en/setVehicleDoorState.md): Changes the state of one or more doors of a vehicle: shut, open, damaged or missing.
- [getVehicleDoorOpenRatio (Shared)](https://wiki.mymp.gg/en/getVehicleDoorOpenRatio.md): Returns how far one or more doors of a vehicle are open.
- [getVehicleLightState (Shared)](https://wiki.mymp.gg/en/getVehicleLightState.md): Returns whether one or more lights of a vehicle are broken.
