GetPlayerVehicleSeat

From GT-MP
Jump to: navigation, search
GetPlayerVehicleSeat
Shared Function
Utilities-terminal.png Server-Side System-users.png Client-Side
Csharp.png C# Javascript.png JavaScript

Returns the seat ID that the player is currently occupying.


Syntax

API.getPlayerVehicleSeat(Client player);

Required Arguments

  • player: parameter input should be in Client type.

NOTE: This function returns data in int type. -3 if not in a vehicle, -1 for driver's seat, 0 upwards for passengers.

Usage example(s)

/myseat command which informs the player about their seat.

In C#
Server-Side Function

[Command("myseat")]
public void CMD_MySeat(Client player)
{
    int seat = API.getPlayerVehicleSeat(player);

    if (seat == -3)
    {
        API.sendChatMessageToPlayer(player, "You're not in a vehicle.");
    }
    else if (seat == -1)
    {
        API.sendChatMessageToPlayer(player, "You're the driver, don't text and drive!");
    }
    else if (seat >= 0)
    {
        API.sendChatMessageToPlayer(player, "You're a passenger.");
    }
}

References