Skip to content
Nexius edited this page Aug 14, 2021 · 7 revisions

PassengerSync (packetid: 211)

Destination:
Incoming/Outgoing

Description:
Called every time a player updates his state in vehicle as a passenger.

Parameters (for incoming packet):

Value type Parameter Short description
PR_UINT8 packetId The ID of the packet
PR_UINT16 vehicleId The ID of the vehicle synced by the passenger
PR_BITS (2) driveBy 0 if the passenger is not in drive-by mode, otherwise 1
PR_BITS (6) seatId The ID of the passenger seat of the player (1 is the front passenger and 2 & 3 are the rear passengers)
PR_BITS (2) additionalKey Additional key a passenger is pressing
PR_BITS (6) weaponId The ID of the weapon a passenger is currently holding
PR_UINT8 playerHealth The health of a passenger
PR_UINT8 playerArmour The armour of a passenger
PR_UINT16 lrKey Left/right key state (if the current key is a left arrow, lrKey equals KEY_LEFT, otherwise KEY_RIGHT. 0 if none of the cases)
PR_UINT16 udKey Up/down key state (if the current key is an up arrow, udKey equals KEY_UP, otherwise KEY_DOWN. 0 if none of the cases)
PR_UINT16 keys Keys (bitmask) a passenger is pressing
PR_FLOAT3 position The position of the vehicle on the X, Y and Z axes

Related SA-MP callbacks:

  • OnPlayerUpdate (when player state is PLAYER_STATE_PASSENGER)

Example (as incoming packet):

const PASSENGER_SYNC = 211;

IPacket:PASSENGER_SYNC(playerid, BitStream:bs)
{
    new passengerData[PR_PassengerSync];

    BS_IgnoreBits(bs, 8);
    BS_ReadPassengerSync(bs, passengerData);

    //Anything you want to see here

    return 1;
}