-
Notifications
You must be signed in to change notification settings - Fork 30
Logging incoming common synchronization packets
Nexius edited this page Jul 21, 2021
·
6 revisions
const PLAYER_SYNC = 207;
const VEHICLE_SYNC = 200;
const PASSENGER_SYNC = 211;
const TRAILER_SYNC = 210;
const UNOCCUPIED_SYNC = 209;
const AIM_SYNC = 203;
const BULLET_SYNC = 206;
const SPECTATING_SYNC = 212;
const WEAPONS_UPDATE_SYNC = 204;
const STATS_UPDATE_SYNC = 205;
const RCON_COMMAND_SYNC = 201;
IPacket:PLAYER_SYNC(playerid, BitStream:bs)
{
new onFootData[PR_OnFootSync];
BS_IgnoreBits(bs, 8);
BS_ReadOnFootSync(bs, onFootData);
printf(
"PLAYER_SYNC[%d]:\nlrKey %d \nudKey %d \nkeys %d \nposition %.2f %.2f %.2f \nquaternion %.2f %.2f %.2f %.2f \nhealth %d \narmour %d \nadditionalKey %d \nweaponId %d \nspecialAction %d \nvelocity %.2f %.2f %.2f \nsurfingOffsets %.2f %.2f %.2f \nsurfingVehicleId %d \nanimationId %d \nanimationFlags %d",
playerid,
onFootData[PR_lrKey],
onFootData[PR_udKey],
onFootData[PR_keys],
onFootData[PR_position][0],
onFootData[PR_position][1],
onFootData[PR_position][2],
onFootData[PR_quaternion][0],
onFootData[PR_quaternion][1],
onFootData[PR_quaternion][2],
onFootData[PR_quaternion][3],
onFootData[PR_health],
onFootData[PR_armour],
onFootData[PR_additionalKey],
onFootData[PR_weaponId],
onFootData[PR_specialAction],
onFootData[PR_velocity][0],
onFootData[PR_velocity][1],
onFootData[PR_velocity][2],
onFootData[PR_surfingOffsets][0],
onFootData[PR_surfingOffsets][1],
onFootData[PR_surfingOffsets][2],
onFootData[PR_surfingVehicleId],
onFootData[PR_animationId],
onFootData[PR_animationFlags]
);
return 1;
}
IPacket:VEHICLE_SYNC(playerid, BitStream:bs)
{
new inCarData[PR_InCarSync];
BS_IgnoreBits(bs, 8);
BS_ReadInCarSync(bs, inCarData);
printf(
"VEHICLE_SYNC[%d]:\nvehicleId %d \nlrKey %d \nudKey %d \nkeys %d \nquaternion %.2f %.2f %.2f %.2f \nposition %.2f %.2f %.2f \nvelocity %.2f %.2f %.2f \nvehicleHealth %.2f \nplayerHealth %d \narmour %d \nadditionalKey %d \nweaponId %d \nsirenState %d \nlandingGearState %d \ntrailerId %d \ntrainSpeed %.2f",
playerid,
inCarData[PR_vehicleId],
inCarData[PR_lrKey],
inCarData[PR_udKey],
inCarData[PR_keys],
inCarData[PR_quaternion][0],
inCarData[PR_quaternion][1],
inCarData[PR_quaternion][2],
inCarData[PR_quaternion][3],
inCarData[PR_position][0],
inCarData[PR_position][1],
inCarData[PR_position][2],
inCarData[PR_velocity][0],
inCarData[PR_velocity][1],
inCarData[PR_velocity][2],
inCarData[PR_vehicleHealth],
inCarData[PR_playerHealth],
inCarData[PR_armour],
inCarData[PR_additionalKey],
inCarData[PR_weaponId],
inCarData[PR_sirenState],
inCarData[PR_landingGearState],
inCarData[PR_trailerId],
inCarData[PR_trainSpeed]
);
return 1;
}
IPacket:PASSENGER_SYNC(playerid, BitStream:bs)
{
new passengerData[PR_PassengerSync];
BS_IgnoreBits(bs, 8);
BS_ReadPassengerSync(bs, passengerData);
printf(
"PASSENGER_SYNC[%d]:\nvehicleId %d \ndriveBy %d \nseatId %d \nadditionalKey %d \nweaponId %d \nplayerHealth %d \nplayerArmour %d \nlrKey %d \nudKey %d \nkeys %d \nposition %.2f %.2f %.2f",
playerid,
passengerData[PR_vehicleId],
passengerData[PR_driveBy],
passengerData[PR_seatId],
passengerData[PR_additionalKey],
passengerData[PR_weaponId],
passengerData[PR_playerHealth],
passengerData[PR_playerArmour],
passengerData[PR_lrKey],
passengerData[PR_udKey],
passengerData[PR_keys],
passengerData[PR_position][0],
passengerData[PR_position][1],
passengerData[PR_position][2]
);
return 1;
}
IPacket:TRAILER_SYNC(playerid, BitStream:bs)
{
new trailerData[PR_TrailerSync];
BS_IgnoreBits(bs, 8);
BS_ReadTrailerSync(bs, trailerData);
printf(
"TRAILER_SYNC[%d]:\ntrailerId %d \nposition %.2f %.2f %.2f \nquaternion %.2f %.2f %.2f %.2f \nvelocity %.2f %.2f %.2f \nangularVelocity %.2f %.2f %.2f",
playerid,
trailerData[PR_trailerId],
trailerData[PR_position][0],
trailerData[PR_position][1],
trailerData[PR_position][2],
trailerData[PR_quaternion][0],
trailerData[PR_quaternion][1],
trailerData[PR_quaternion][2],
trailerData[PR_quaternion][3],
trailerData[PR_velocity][0],
trailerData[PR_velocity][1],
trailerData[PR_velocity][2],
trailerData[PR_angularVelocity][0],
trailerData[PR_angularVelocity][1],
trailerData[PR_angularVelocity][2]
);
return 1;
}
IPacket:UNOCCUPIED_SYNC(playerid, BitStream:bs)
{
new unoccupiedData[PR_UnoccupiedSync];
BS_IgnoreBits(bs, 8);
BS_ReadUnoccupiedSync(bs, unoccupiedData);
printf(
"UNOCCUPIED_SYNC[%d]:\nvehicleId %d \nseatId %d \nroll %.2f %.2f %.2f \ndirection %.2f %.2f %.2f \nposition %.2f %.2f %.2f \nvelocity %.2f %.2f %.2f \nangularVelocity %.2f %.2f %.2f \nvehicleHealth %.2f",
playerid,
unoccupiedData[PR_vehicleId],
unoccupiedData[PR_seatId],
unoccupiedData[PR_roll][0],
unoccupiedData[PR_roll][1],
unoccupiedData[PR_roll][2],
unoccupiedData[PR_direction][0],
unoccupiedData[PR_direction][1],
unoccupiedData[PR_direction][2],
unoccupiedData[PR_position][0],
unoccupiedData[PR_position][1],
unoccupiedData[PR_position][2],
unoccupiedData[PR_velocity][0],
unoccupiedData[PR_velocity][1],
unoccupiedData[PR_velocity][2],
unoccupiedData[PR_angularVelocity][0],
unoccupiedData[PR_angularVelocity][1],
unoccupiedData[PR_angularVelocity][2],
unoccupiedData[PR_vehicleHealth]
);
return 1;
}
IPacket:AIM_SYNC(playerid, BitStream:bs)
{
new aimData[PR_AimSync];
BS_IgnoreBits(bs, 8);
BS_ReadAimSync(bs, aimData);
printf(
"AIM_SYNC[%d]:\ncamMode %d \ncamFrontVec %.2f %.2f %.2f \ncamPos %.2f %.2f %.2f \naimZ %.2f \nweaponState %d \ncamZoom %d \naspectRatio %d",
playerid,
aimData[PR_camMode],
aimData[PR_camFrontVec][0],
aimData[PR_camFrontVec][1],
aimData[PR_camFrontVec][2],
aimData[PR_camPos][0],
aimData[PR_camPos][1],
aimData[PR_camPos][2],
aimData[PR_aimZ],
aimData[PR_weaponState],
aimData[PR_camZoom],
aimData[PR_aspectRatio]
);
return 1;
}
IPacket:BULLET_SYNC(playerid, BitStream:bs)
{
new bulletData[PR_BulletSync];
BS_IgnoreBits(bs, 8);
BS_ReadBulletSync(bs, bulletData);
printf(
"BULLET_SYNC[%d]:\nhitType %d \nhitId %d \norigin %.2f %.2f %.2f \nhitPos %.2f %.2f %.2f \noffsets %.2f %.2f %.2f \nweaponId %d",
playerid,
bulletData[PR_hitType],
bulletData[PR_hitId],
bulletData[PR_origin][0],
bulletData[PR_origin][1],
bulletData[PR_origin][2],
bulletData[PR_hitPos][0],
bulletData[PR_hitPos][1],
bulletData[PR_hitPos][2],
bulletData[PR_offsets][0],
bulletData[PR_offsets][1],
bulletData[PR_offsets][2],
bulletData[PR_weaponId]
);
return 1;
}
IPacket:SPECTATING_SYNC(playerid, BitStream:bs)
{
new spectatingData[PR_SpectatingSync];
BS_IgnoreBits(bs, 8);
BS_ReadSpectatingSync(bs, spectatingData);
printf(
"SPECTATING_SYNC[%d]:\nlrKey %d \nudKey %d \nkeys %d \nposition %.2f %.2f %.2f",
playerid,
spectatingData[PR_lrKey],
spectatingData[PR_udKey],
spectatingData[PR_keys],
spectatingData[PR_position][0],
spectatingData[PR_position][1],
spectatingData[PR_position][2]
);
return 1;
}
IPacket:WEAPONS_UPDATE_SYNC(playerid, BitStream:bs)
{
new weaponsUpdate[PR_WeaponsUpdate];
BS_IgnoreBits(bs, 8);
BS_ReadWeaponsUpdate(bs, weaponsUpdate);
printf(
"WEAPONS_UPDATE_SYNC[%d]:\ntargetId %d \ntargetActorId %d \nslotWeaponId %d %d %d %d %d %d %d %d %d %d %d %d %d \nslotWeaponAmmo %d %d %d %d %d %d %d %d %d %d %d %d %d",
playerid,
weaponsUpdate[PR_targetId],
weaponsUpdate[PR_targetActorId],
weaponsUpdate[PR_slotWeaponId][0],
weaponsUpdate[PR_slotWeaponId][1],
weaponsUpdate[PR_slotWeaponId][2],
weaponsUpdate[PR_slotWeaponId][3],
weaponsUpdate[PR_slotWeaponId][4],
weaponsUpdate[PR_slotWeaponId][5],
weaponsUpdate[PR_slotWeaponId][6],
weaponsUpdate[PR_slotWeaponId][7],
weaponsUpdate[PR_slotWeaponId][8],
weaponsUpdate[PR_slotWeaponId][9],
weaponsUpdate[PR_slotWeaponId][10],
weaponsUpdate[PR_slotWeaponId][11],
weaponsUpdate[PR_slotWeaponId][12],
weaponsUpdate[PR_slotWeaponAmmo][0],
weaponsUpdate[PR_slotWeaponAmmo][1],
weaponsUpdate[PR_slotWeaponAmmo][2],
weaponsUpdate[PR_slotWeaponAmmo][3],
weaponsUpdate[PR_slotWeaponAmmo][4],
weaponsUpdate[PR_slotWeaponAmmo][5],
weaponsUpdate[PR_slotWeaponAmmo][6],
weaponsUpdate[PR_slotWeaponAmmo][7],
weaponsUpdate[PR_slotWeaponAmmo][8],
weaponsUpdate[PR_slotWeaponAmmo][9],
weaponsUpdate[PR_slotWeaponAmmo][10],
weaponsUpdate[PR_slotWeaponAmmo][11],
weaponsUpdate[PR_slotWeaponAmmo][12]
);
return 1;
}
IPacket:STATS_UPDATE_SYNC(playerid, BitStream:bs)
{
new statsUpdate[PR_StatsUpdate];
BS_IgnoreBits(bs, 8);
BS_ReadStatsUpdate(bs, statsUpdate);
printf(
"STATS_UPDATE_SYNC[%d]:\nmoney %d \ndrunkLevel %d",
playerid,
statsUpdate[PR_money],
statsUpdate[PR_drunkLevel]
);
return 1;
}
IPacket:RCON_COMMAND_SYNC(playerid, BitStream:bs)
{
new rconCommand[PR_RconCommand];
BS_IgnoreBits(bs, 8);
BS_ReadRconCommand(bs, rconCommand);
printf(
"RCON_COMMAND_SYNC[%d]:\ncommand %s",
playerid,
rconCommand[PR_command]
);
return 1;
}
- Refer to BrunoBM16's RPC and Packet lists