-
Notifications
You must be signed in to change notification settings - Fork 30
InCarSync
Nexius edited this page Feb 26, 2023
·
33 revisions
Destination:
Incoming/Outgoing
Description:
Called every time a player updates his state in vehicle as a driver.
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 driver |
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 driver is pressing |
PR_FLOAT4 |
quaternion | Vehicle's rotation on all axes as a quaternion (W, X, Y, Z) |
PR_FLOAT3 |
position | The position of the vehicle on the X, Y and Z axes |
PR_FLOAT3 |
velocity | The velocity of the vehicle on the X, Y and Z axes |
PR_FLOAT |
vehicleHealth | The health of the vehicle |
PR_UINT8 |
playerHealth | The health of a driver |
PR_UINT8 |
armour | The armour of a driver |
PR_BITS (2) |
additionalKey | Additional key a driver is pressing |
PR_BITS (6) |
weaponId | The ID of the weapon a driver is currently holding |
PR_UINT8 |
sirenState | Vehicle siren state |
PR_UINT8 |
landingGearState | Plane's landing gear state (for Hydra and similar vehicles). It's also used by vehicles like forklift to sync the state of the forks |
PR_UINT16 |
trailerId | The ID of the trailer attached to this vehicle (0 if none) |
PR_FLOAT |
trainSpeed | Additional data (see the note below) |
Note:
The additional data which is stored in trainSpeed
is either train speed for trains (PR_FLOAT), bike incline for bikes (PR_FLOAT) or supposedly Hydra thrust angle (UINT16 + UINT16).
Related SA-MP callbacks:
- OnPlayerUpdate (when player state is PLAYER_STATE_DRIVER)
Example (as incoming packet):
const VEHICLE_SYNC = 200;
IPacket:VEHICLE_SYNC(playerid, BitStream:bs)
{
new inCarData[PR_InCarSync];
BS_IgnoreBits(bs, 8);
BS_ReadInCarSync(bs, inCarData);
//Anything you want to see here
return 1;
}
- Refer to BrunoBM16's RPC and Packet lists