GetPlayerVehicleSeat

From SA-MP Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 14:24, 21 March 2017
OstGot (Talk | contribs)

← Previous diff
Current revision
OstGot (Talk | contribs)

Line 9: Line 9:
{{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.}} {{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.}}
- 
-{{note2|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.}} 
{{Example}} {{Example}}

Current revision



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 which seat a player is in.


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


Return Values:

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.


Example Usage:

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.

Personal tools
In other languages