Files
RAGECOOP-V/Core/Packets/SyncEvents/BulletShot.cs

66 lines
1.3 KiB
C#
Raw Normal View History

2022-09-08 12:41:56 -07:00
using GTA.Math;
2022-05-22 15:55:26 +08:00
using Lidgren.Network;
namespace RageCoop.Core
{
2022-07-01 14:39:43 +08:00
internal partial class Packets
2022-05-22 15:55:26 +08:00
{
2022-07-01 14:39:43 +08:00
internal class BulletShot : Packet
2022-05-22 15:55:26 +08:00
{
2022-09-08 12:41:56 -07:00
public override PacketType Type => PacketType.BulletShot;
2022-05-22 15:55:26 +08:00
public int OwnerID { get; set; }
public uint WeaponHash { get; set; }
public Vector3 StartPosition { get; set; }
public Vector3 EndPosition { get; set; }
2022-05-22 15:55:26 +08:00
protected override void Serialize(NetOutgoingMessage m)
2022-05-22 15:55:26 +08:00
{
2022-05-22 15:55:26 +08:00
// Write OwnerID
m.Write(OwnerID);
2022-05-22 15:55:26 +08:00
// Write weapon hash
m.Write(WeaponHash);
2022-05-22 15:55:26 +08:00
// Write StartPosition
m.Write(StartPosition);
2022-05-22 15:55:26 +08:00
// Write EndPosition
m.Write(EndPosition);
2022-05-22 15:55:26 +08:00
}
public override void Deserialize(NetIncomingMessage m)
2022-05-22 15:55:26 +08:00
{
#region NetIncomingMessageToPacket
2022-05-22 15:55:26 +08:00
// Read OwnerID
2022-09-08 12:41:56 -07:00
OwnerID = m.ReadInt32();
2022-05-22 15:55:26 +08:00
// Read WeponHash
2022-09-08 12:41:56 -07:00
WeaponHash = m.ReadUInt32();
2022-05-22 15:55:26 +08:00
// Read StartPosition
2022-09-08 12:41:56 -07:00
StartPosition = m.ReadVector3();
2022-05-22 15:55:26 +08:00
// Read EndPosition
2022-09-08 12:41:56 -07:00
EndPosition = m.ReadVector3();
2022-05-22 15:55:26 +08:00
#endregion
}
}
}
}