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

SpectatingSync (packetid: 212)

Destination:
Incoming/Outgoing

Description:
Called every time a player updates his state as a spectator.

Parameters (for incoming packet):

Value type Parameter Short description
PR_UINT8 packetId The ID of the packet
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 player is pressing
PR_FLOAT3 position The position of a player on the X, Y and Z axes

Related SA-MP callbacks:

  • OnPlayerUpdate (when player state is PLAYER_STATE_SPECTATING)

Example (as incoming packet):

const SPECTATING_SYNC = 212;

IPacket:SPECTATING_SYNC(playerid, BitStream:bs)
{
    new spectatingData[PR_SpectatingSync];

    BS_IgnoreBits(bs, 8);
    BS_ReadSpectatingSync(bs, spectatingData);

    //Anything you want to see here

    return 1;
}