new ID_PLAYER_SYNC = 116;
new ID_TRAILER_SYNC = 114;
public OnPlayerReceivedPacket(player_id, packet_id, BitStream:bs)
{
if(packet_id == ID_TRAILER_SYNC)
{
new trailerid;
BS_IgnoreBits(bs, 8); // packet id
BS_ReadValue(bs, RNM_UINT16, trailerid);
if(GetPlayerState(player_id) != PLAYER_STATE_DRIVER) return 0;
if(!OnPlayerUpdateTrailer(player_id, trailerid)) return 0; // отменяем по желанию в функции выше
return 1;
}
if(packet_id == ID_PLAYER_SYNC)
{
new lrkeys, udkeys, sampkeys,
Float:pos[3], Float:quaternion[4],
health, armor, weaponid, specialaction,
Float:speed[3], Float:surfingoffsets[3],
surfingvehid, animationid, animflags;
BS_IgnoreBits(bs, 8); // packet id
BS_ReadValue(bs, RNM_UINT16, lrkeys,
RNM_UINT16, udkeys,
RNM_UINT16, sampkeys,
RNM_FLOAT, pos[0],
RNM_FLOAT, pos[1],
RNM_FLOAT, pos[2],
RNM_FLOAT, quaternion[0],
RNM_FLOAT, quaternion[1],
RNM_FLOAT, quaternion[2],
RNM_FLOAT, quaternion[3],
RNM_UINT8, health,
RNM_UINT8, armor,
RNM_UINT8, weaponid,
RNM_UINT8, specialaction,
RNM_FLOAT, speed[0],
RNM_FLOAT, speed[1],
RNM_FLOAT, speed[2],
RNM_FLOAT, surfingoffsets[0],
RNM_FLOAT, surfingoffsets[1],
RNM_FLOAT, surfingoffsets[2],
RNM_UINT16, surfingvehid,
RNM_INT16, animationid,
RNM_INT16, animflags);
if (weaponid == 38) weaponid = 0;
BS_Reset(bs);
BS_WriteValue(bs, RNM_UINT8, packet_id,
RNM_UINT16, lrkeys,
RNM_UINT16, udkeys,
RNM_UINT16, sampkeys,
RNM_FLOAT, pos[0],
RNM_FLOAT, pos[1],
RNM_FLOAT, pos[2],
RNM_FLOAT, quaternion[0],
RNM_FLOAT, quaternion[1],
RNM_FLOAT, quaternion[2],
RNM_FLOAT, quaternion[3],
RNM_UINT8, health,
RNM_UINT8, armor,
RNM_UINT8, weaponid,
RNM_UINT8, specialaction,
RNM_FLOAT, speed[0],
RNM_FLOAT, speed[1],
RNM_FLOAT, speed[2],
RNM_FLOAT, surfingoffsets[0],
RNM_FLOAT, surfingoffsets[1],
RNM_FLOAT, surfingoffsets[2],
RNM_UINT16, surfingvehid,
RNM_INT16, animationid,
RNM_INT16, animflags);
}
return 1;
}