Add vehicle livery sync
This commit is contained in:
@ -397,6 +397,7 @@ namespace RageCoop.Client
|
||||
v.LockStatus=packet.LockStatus;
|
||||
v.RadioStation=packet.RadioStation;
|
||||
v.LicensePlate=packet.LicensePlate;
|
||||
v.Livery=packet.Livery;
|
||||
v.Flags=packet.Flag;
|
||||
foreach (KeyValuePair<int, int> pair in packet.Passengers)
|
||||
{
|
||||
|
@ -108,7 +108,7 @@ namespace RageCoop.Client
|
||||
{
|
||||
Function.Call<byte>(Hash.GET_VEHICLE_COLOURS, veh, &primaryColor, &secondaryColor);
|
||||
}
|
||||
var packet=new Packets.VehicleStateSync()
|
||||
var packet = new Packets.VehicleStateSync()
|
||||
{
|
||||
ID =v.ID,
|
||||
OwnerID = v.OwnerID,
|
||||
@ -122,7 +122,8 @@ namespace RageCoop.Client
|
||||
EngineHealth=veh.EngineHealth,
|
||||
Passengers=veh.GetPassengers(),
|
||||
LockStatus=veh.LockStatus,
|
||||
LicensePlate=Function.Call<string>(Hash.GET_VEHICLE_NUMBER_PLATE_TEXT, veh)
|
||||
LicensePlate=Function.Call<string>(Hash.GET_VEHICLE_NUMBER_PLATE_TEXT, veh),
|
||||
Livery=Function.Call<int>(Hash.GET_VEHICLE_LIVERY, veh)
|
||||
};
|
||||
if (v.MainVehicle==Game.Player.LastVehicle)
|
||||
{
|
||||
|
@ -100,6 +100,8 @@ namespace RageCoop.Client
|
||||
internal Dictionary<VehicleSeat, SyncedPed> Passengers { get; set; }
|
||||
internal byte RadioStation = 255;
|
||||
internal string LicensePlate { get; set; }
|
||||
internal int _lastLivery = -1;
|
||||
internal int Livery { get; set; } = -1;
|
||||
internal bool _checkSeat { get; set; } = true;
|
||||
|
||||
#endregion
|
||||
@ -340,6 +342,12 @@ namespace RageCoop.Client
|
||||
{
|
||||
Function.Call(Hash.SET_VEHICLE_NUMBER_PLATE_TEXT,MainVehicle,LicensePlate);
|
||||
}
|
||||
|
||||
if (_lastLivery!=Livery)
|
||||
{
|
||||
Function.Call(Hash.SET_VEHICLE_LIVERY, MainVehicle, Livery);
|
||||
_lastLivery=Livery;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
LastUpdated=Main.Ticked;
|
||||
|
@ -38,6 +38,8 @@ namespace RageCoop.Core
|
||||
|
||||
public VehicleLockStatus LockStatus { get; set; }
|
||||
|
||||
public int Livery { get; set; } = -1;
|
||||
|
||||
/// <summary>
|
||||
/// VehicleSeat,PedID
|
||||
/// </summary>
|
||||
@ -140,6 +142,8 @@ namespace RageCoop.Core
|
||||
}
|
||||
byteArray.AddRange(Encoding.ASCII.GetBytes(LicensePlate));
|
||||
|
||||
byteArray.Add((byte)(Livery+1));
|
||||
|
||||
byte[] result = byteArray.ToArray();
|
||||
|
||||
message.Write(result.Length);
|
||||
@ -231,6 +235,8 @@ namespace RageCoop.Core
|
||||
RadioStation=reader.ReadByte();
|
||||
|
||||
LicensePlate=Encoding.ASCII.GetString(reader.ReadByteArray(8));
|
||||
|
||||
Livery=(int)(reader.ReadByte()-1);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user