public static VehicleData ReadLightVehicleSync(byte[] array) { var data = new VehicleData(); var r = new BitReader(array); // Read player nethandle data.NetHandle = r.ReadInt32(); // read model data.PedModelHash = r.ReadInt32(); // read vehicle handle data.VehicleHandle = r.ReadInt32(); // read vehicle seat data.VehicleSeat = (sbyte)r.ReadByte(); // read gun model. data.WeaponHash = r.ReadInt32(); // Read vehicle damage model if (r.ReadBoolean()) { data.DamageModel = new VehicleDamageModel(); data.DamageModel.BrokenDoors = r.ReadByte(); data.DamageModel.BrokenWindows = r.ReadByte(); data.DamageModel.BrokenLights = r.ReadInt32(); } // Does he have a traielr? if (r.ReadBoolean()) { Vector3 trailerPos = new Vector3(); trailerPos.X = r.ReadSingle(); trailerPos.Y = r.ReadSingle(); trailerPos.Z = r.ReadSingle(); data.Trailer = trailerPos; } // Try to read latency if (r.CanRead(2)) { var latency = r.ReadInt16(); data.Latency = latency / 1000f; } return(data); }
public static PedData ReadLightPedSync(byte[] array) { var data = new PedData(); var r = new BitReader(array); // Read player nethandle data.NetHandle = r.ReadInt32(); // Read player model data.PedModelHash = r.ReadInt32(); // If we can, read latency if (r.CanRead(2)) { var latency = r.ReadInt16(); data.Latency = latency / 1000f; } return(data); }