Skip to content
Nexius edited this page Dec 16, 2023 · 23 revisions

OnFootSync (packetid: 207)

Destination:
Incoming/Outgoing

Description:
Called every time a player updates his state on foot.

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
PR_FLOAT4 quaternion Player's rotation on all axes as a quaternion (W, X, Y, Z)
PR_UINT8 health The health of a player
PR_UINT8 armour The armour of a player
PR_BITS (2) additionalKey Additional key a player is pressing
PR_BITS (6) weaponId The ID of the weapon a player is currently holding
PR_UINT8 specialAction The special action of a player
PR_FLOAT3 velocity The velocity of a player on the X, Y and Z axes
PR_FLOAT3 surfingOffsets The surfing offsets of a player on the X, Y and Z axes (relative to the surfingVehicleId). 0.0 on all offsets if the player isn't surfing
PR_UINT16 surfingVehicleId The ID of the vehicle/object that the player is surfing on (0 if none)
PR_INT16 animationId The ID of player's current animation
PR_INT16 animationFlags Additional flags of the current animation

Note:
If player is surfing on an object, surfingVehicleId will store it's ID as "MAX_VEHICLES (offset) + objectid".

Related SA-MP callbacks:

  • OnPlayerUpdate (when player state is PLAYER_STATE_ONFOOT)

Example (as incoming packet):

const PLAYER_SYNC = 207;

IPacket:PLAYER_SYNC(playerid, BitStream:bs)
{
    new onFootData[PR_OnFootSync];

    BS_IgnoreBits(bs, 8);
    BS_ReadOnFootSync(bs, onFootData);

    //Anything you want to see here

    return 1;
}