The open.mp logo
Home
FAQ
Forums
Servers
Partners
Docs
Blog

warning Not Translated

This page has not been translated into the language that your browser requested yet. The English content is being shown as a fallback.

If you want to contribute a translation for this page then please click here.

GetPlayerVehicleID

Description

This function gets the ID of the vehicle the player is currently in. Note: NOT the model id of the vehicle. See GetVehicleModel for that.

NameDescription
playeridThe ID of the player in the vehicle that you want to get the ID of

Returns

ID of the vehicle or 0 if not in a vehicle

Examples

// Add 10x Nitro if the player is in a car. Might be called on a command.
new vehicleId;
vehicleId = GetPlayerVehicleID(playerid);
if (vehicleId != 0)
{
    AddVehicleComponent(vehicleId, 1010);
}

Related Functions

  • IsPlayerInVehicle: Check if a player is in a certain vehicle.
  • IsPlayerInAnyVehicle: Check if a player is in any vehicle.
  • GetPlayerVehicleSeat: Check what seat a player is in.
  • GetVehicleModel: Get the model id of a vehicle.

Community

  • Discord
  • Instagram
  • Twitter
  • Twitch
  • YouTube
  • Facebook
  • VK

More

  • SA-MP
  • Blog
  • GitHub