---
title: "NPC_GetVehicleID | open.mp"
description: "Obtém o veículo ID do veículo atual de um NPC."
canonical: https://omp.itsneufox.com/pt-BR/docs/scripting/functions/NPC_GetVehicleID
language: pt-BR
---

# NPC\_GetVehicleID

aviso

Esta função foi adicionada no omp v1.5.8.3079 e não funcionará em versões anteriores!

## Descrição

Obtém o veículo ID do veículo atual de um NPC.

| Nome | Descrição |
| --- | --- |
| npcid | O ID do NPC |

## Retornos

Devolve o veículo ID em que NPC está, ou INVALID\_VEHICLE\_ID se não estiver em nenhum veículo.

## Exemplos

```c
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (!strcmp(cmdtext, "/checkvehicleid", true))
    {
        new npcid = PlayerNPC[playerid];
        if (npcid == INVALID_NPC_ID)
            return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC.");

        if (!NPC_IsValid(npcid))
            return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC.");

        new vehicleid = NPC_GetVehicleID(npcid);

        if (vehicleid == INVALID_VEHICLE_ID)
            SendClientMessage(playerid, 0xFFFF00FF, "NPC %d is not in any vehicle.", npcid);
        else
            SendClientMessage(playerid, 0x00FF00FF, "NPC %d vehicle ID: %d", npcid, vehicleid);
        return 1;
    }
    return 0;
}
```

## Notas

-   Retorna INVALID\_VEHICLE\_ID se o NPC não estiver em nenhum veículo

## Funções Relacionadas

-   [NPC\_GetVehicleSeat](https://omp.itsneufox.com/pt-BR/docs/scripting/functions/NPC_GetVehicleSeat): Obtenha o assento de NPC no veículo
-   [NPC\_PutInVehicle](https://omp.itsneufox.com/pt-BR/docs/scripting/functions/NPC_PutInVehicle): Coloque NPC no veículo
-   [NPC\_RemoveFromVehicle](https://omp.itsneufox.com/pt-BR/docs/scripting/functions/NPC_RemoveFromVehicle): Remova NPC do veículo
-   [NPC\_GetVehicle](https://omp.itsneufox.com/pt-BR/docs/scripting/functions/NPC_GetVehicle): Função alternativa com comportamento idêntico

## Callbacks Relacionadas

_Nenhum callback específico é acionado por esta função._
