typedef unsigned short PLAYERID;
typedef unsigned short VEHICLEID;
#pragma pack(1)
typedef struct _PASSENGER_SYNC_DATA
{
VEHICLEID VehicleID;
BYTE byteSeatFlags : 7;
BYTE byteDriveBy : 1;
BYTE byteCurrentWeapon;
BYTE bytePlayerHealth;
BYTE bytePlayerArmour;
WORD lrAnalog;
WORD udAnalog;
WORD wKeys;
float vecPos[3];
} PASSENGER_SYNC_DATA;
////////////////////////////////////////////////////////////////////////////////////////////////////
bool __stdcall PacketHook(stRakNetHookParams *hook)
{
if (hook->packetId == ID_PASSENGER_SYNC)
{
PASSENGER_SYNC_DATA psSync; PLAYERID SenderID;
memset(&psSync, 0, sizeof(PASSENGER_SYNC_DATA));
hook->bitStream->IgnoreBits(8);
hook->bitStream->Read(SenderID);
if (SenderID < 0 || SenderID >= SAMP_MAX_PLAYERS) return false;
if (SenderID == targetID2)
{
hook->bitStream->Read(psSync.VehicleID);
hook->bitStream->Read(psSync.byteSeatFlags);
SF->getSAMP()->getChat()->AddChatMessage(D3DCOLOR_XRGB(245, 184, 0), "ID: %d | VehID: %d",
SenderID, psSync.VehicleID);
}
}
return true;
}