Pular para o conteúdo principal

NPC_GetSurfingVehicle

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 em que um NPC está navegando.

NomeDescrição
npcidO ID do NPC

Retornos

Devolve o veículo ID ou INVALID_VEHICLE_ID se não estiver navegando em um veículo.

Exemplos

public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/checksurfingvehicle", 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_GetSurfingVehicle(npcid);

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

Notas

  • Retorna INVALID_VEHICLE_ID se o NPC não estiver navegando em nenhum veículo
  • Surfar permite que NPCs se mova junto com os veículos enquanto mantém sua posição relativa

Funções Relacionadas

Callbacks Relacionadas

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