GetPlayerVehicleSeat

From SA-MP Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 19:16, 6 May 2011
Calgon (Talk | contribs)
(Fixed after Smithy broke the example's integrity check for 128)
← Previous diff
Revision as of 13:32, 31 January 2014
Connor Mead (Talk | contribs)

Next diff →
Line 1: Line 1:
{{Scripting}} {{Scripting}}
-{{Title}} 
{{0.3Added|function|}} {{0.3Added|function|}}
Line 31: Line 30:
[[Category:Scripting Functions]] [[Category:Scripting Functions]]
 +[[fr:GetPlayerVehicleSeat]]

Revision as of 13:32, 31 January 2014



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


Description:

Find out what seat a player is in.


Parameters:
(playerid)
playeridThe ID of the player you want to get the seat of.

Return Values:

Seat ID (-1 if the player is not in a vehicle, 0 driver, 1 co-driver, 2&3 back seat passengers, 4+ if the vehicle has enough seats (i.e coach)).


Image:32px-Ambox_warning_orange.png

Note

Sometimes the result can be 128 which is an invalid seat ID. Circumstances of this are not yet known, but it is best to discard information when returned seat number is 128.


if(strcmp(cmdtext, "/myseat", true) == 0)
{
    new szString[14], iSeat = GetPlayerVehicleSeat(playerid);
 
    // How you can discard of your information.
    if(iSeat == 128) return SendClientMessage(playerid, 0xFFFFFFFF, "An error has prevented us from returning the seat ID.");
 
    format(szString, sizeof(szString), "Your seat: %i", iSeat);
    SendClientMessage(playerid, 0xFFFFFFFF, szString);
    return 1;
}

Related Functions

The following functions may be useful, as they are related to this function in one way or another.

In other languages