پرش به مطلب اصلی

NPC_GetVehicleSeat

هشدار

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

Description

Gets the seat ID of an NPC in a vehicle.

NameDescription
npcidThe ID of the NPC

Returns

Returns the seat ID, or -1 if not in a vehicle.

Examples

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

if (NPC_GetVehicle(npcid) == INVALID_VEHICLE_ID)
return SendClientMessage(playerid, 0xFFFF00FF, "NPC %d is not in any vehicle.", npcid);

new seatid = NPC_GetVehicleSeat(npcid);

SendClientMessage(playerid, 0x00FF00FF, "NPC %d vehicle seat: %d", npcid, seatid);
return 1;
}
return 0;
}

Seat IDs

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

Notes

  • Returns -1 if the NPC is not in any vehicle
  • Seat 0 is always the driver seat
  • Maximum seat ID depends on the vehicle model

No specific callbacks are triggered by this function.