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.

GetPlayerVehicleSeat

warning

This function was added in SA-MP 0.3a and will not work in earlier versions!

Description

Find out which seat a player is in.

NameDescription
playeridThe ID of the player you want to get the seat of.

Returns

The ID of the seat the player is in. -1 is not in vehicle, 0 is the driver, 1 is the front passenger, and 2 & 3 are the rear passengers.

Examples

if (strcmp(cmdtext, "/myseat", true) == 0)
{
    new
        playerSeat = GetPlayerVehicleSeat(playerid);

    // How you can discard of your information.
    if (playerSeat == 128)
    {
        return SendClientMessage(playerid, 0xFFFFFFFF, "An error has prevented us from returning the seat ID.");
    }

    new
        message[14];

    format(message, sizeof(message), "Your seat: %i", playerSeat);
    SendClientMessage(playerid, 0xFFFFFFFF, message);
    return 1;
}

Related Functions

  • GetPlayerVehicleID: Get the ID of the vehicle the player is in.
  • PutPlayerInVehicle: Put a player in a vehicle.

Community

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

More

  • SA-MP
  • Blog
  • GitHub