Skip to content
Nexius edited this page Mar 15, 2020 · 9 revisions

SpectatingSync (packetid: 212)

Destination:
Incoming/Outcoming

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 or right key state
PR_UINT16 udKey Up or down key state
PR_UINT16 keys Keys 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;
}