---
title: "NPC_EnterVehicle | open.mp"
description: "Makes an NPC enter a vehicle."
canonical: https://omp.itsneufox.com/docs/scripting/functions/NPC_EnterVehicle
language: en
---

# NPC\_EnterVehicle

warning

This function was added in omp v1.5.8.3079 and will not work in earlier versions!

## Description

Makes an NPC enter a vehicle by walking to it and getting in.

| Name | Description |
| --- | --- |
| npcid | The ID of the NPC |
| vehicleid | The ID of the vehicle to enter |
| seatid | The seat to enter |
| moveType | The movement type to use when approaching |

## Returns

Returns `true` if the operation was successful, `false` otherwise.

## Examples

```c
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (!strcmp(cmdtext, "/npcenterbike ", true, 14))
    {
        new seatid = strval(cmdtext[15]);
        if (cmdtext[15] == '\0')
            return SendClientMessage(playerid, 0xFF0000FF, "Usage: /npcenterbike [seatid]");

        new npcid = PlayerNPC[playerid];
        if (npcid == INVALID_NPC_ID)
            return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC.");

        new vehicleid = PlayerVehicles[playerid][0];
        if (vehicleid == INVALID_VEHICLE_ID)
            return SendClientMessage(playerid, 0xFF0000FF, "Your motorcycle is not available.");

        if (NPC_EnterVehicle(npcid, vehicleid, seatid, NPC_MOVE_TYPE_JOG))
            SendClientMessage(playerid, 0x00FF00FF, "NPC %d is entering motorcycle (seat %d).", npcid, seatid);
        else
            SendClientMessage(playerid, 0xFF0000FF, "NPC %d failed to enter motorcycle (seat %d).", npcid, seatid);

        return 1;
    }
    return 0;
}
```

## Seat IDs

| ID | Seat |
| --- | --- |
| 0 | Driver |
| 1 | Front passenger |
| 2 | Back-left passenger |
| 3 | Back-right passenger |
| 4+ | Passenger seats (coach etc.) |

## Notes

-   The NPC will try to reach the vehicle door, using the specified movement type, before entering
-   If the seat is occupied, the NPC may not be able to enter

## Related Functions

-   [NPC\_ExitVehicle](https://omp.itsneufox.com/docs/scripting/functions/NPC_ExitVehicle): Make NPC exit vehicle
-   [NPC\_PutInVehicle](https://omp.itsneufox.com/docs/scripting/functions/NPC_PutInVehicle): Instantly put NPC in vehicle
-   [NPC\_GetVehicle](https://omp.itsneufox.com/docs/scripting/functions/NPC_GetVehicle): Get NPC's current vehicle
-   [NPC\_IsEnteringVehicle](https://omp.itsneufox.com/docs/scripting/functions/NPC_IsEnteringVehicle): Check if NPC is entering vehicle

## Related Callbacks

_No specific callbacks are triggered by this function._
