Add license plate sync
This commit is contained in:
@ -370,6 +370,7 @@ namespace RageCoop.Client
|
||||
v.Passengers=new Dictionary<VehicleSeat, SyncedPed>();
|
||||
v.LockStatus=packet.LockStatus;
|
||||
v.RadioStation=packet.RadioStation;
|
||||
v.LicensePlate=packet.LicensePlate;
|
||||
v.Flags=packet.Flag;
|
||||
foreach (KeyValuePair<int, int> pair in packet.Passengers)
|
||||
{
|
||||
|
@ -111,6 +111,7 @@ namespace RageCoop.Client
|
||||
EngineHealth=veh.EngineHealth,
|
||||
Passengers=veh.GetPassengers(),
|
||||
LockStatus=veh.LockStatus,
|
||||
LicensePlate=Function.Call<string>(Hash.GET_VEHICLE_NUMBER_PLATE_TEXT, veh)
|
||||
};
|
||||
if (v.MainVehicle==Game.Player.LastVehicle)
|
||||
{
|
||||
|
@ -720,6 +720,11 @@ namespace RageCoop.Client
|
||||
Function.Call(Hash.SET_VEHICLE_TURRET_SPEED_THIS_FRAME, MainPed.CurrentVehicle, 100);
|
||||
Function.Call(Hash.TASK_VEHICLE_AIM_AT_COORD, MainPed.Handle, AimCoords.X, AimCoords.Y, AimCoords.Z);
|
||||
}
|
||||
/*
|
||||
Function.Call(Hash.TASK_SWEEP_AIM_ENTITY,P, "random@paparazzi@pap_anims", "sweep_low", "sweep_med", "sweep_high", -1,V, 1.57f, 0.25f);
|
||||
Function.Call(Hash.SET_PED_STEALTH_MOVEMENT, P,true, 0);
|
||||
return Function.Call<bool>(Hash.GET_PED_STEALTH_MOVEMENT, P);
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -97,6 +97,7 @@ namespace RageCoop.Client
|
||||
/// </summary>
|
||||
internal Dictionary<VehicleSeat, SyncedPed> Passengers { get; set; }
|
||||
internal byte RadioStation = 255;
|
||||
internal string LicensePlate { get; set; }
|
||||
|
||||
#endregion
|
||||
internal override void Update()
|
||||
@ -116,10 +117,7 @@ namespace RageCoop.Client
|
||||
return;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region -- SYNC CRITICAL --
|
||||
|
||||
|
||||
if (SteeringAngle != MainVehicle.SteeringAngle)
|
||||
{
|
||||
MainVehicle.CustomSteeringAngle((float)(Math.PI / 180) * SteeringAngle);
|
||||
@ -333,6 +331,10 @@ namespace RageCoop.Client
|
||||
}
|
||||
}
|
||||
|
||||
if (Function.Call<string>(Hash.GET_VEHICLE_NUMBER_PLATE_TEXT, MainVehicle)!=LicensePlate)
|
||||
{
|
||||
Function.Call(Hash.SET_VEHICLE_NUMBER_PLATE_TEXT,MainVehicle,LicensePlate);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
LastUpdated=Main.Ticked;
|
||||
|
@ -4,6 +4,7 @@ using System.Text;
|
||||
using GTA;
|
||||
using GTA.Math;
|
||||
using Lidgren.Network;
|
||||
using System.Linq;
|
||||
|
||||
namespace RageCoop.Core
|
||||
{
|
||||
@ -43,6 +44,7 @@ namespace RageCoop.Core
|
||||
public Dictionary<int, int> Passengers { get; set; }
|
||||
|
||||
public byte RadioStation { get; set; } = 255;
|
||||
public string LicensePlate { get; set; }
|
||||
public override void Pack(NetOutgoingMessage message)
|
||||
{
|
||||
#region PacketToNetOutGoingMessage
|
||||
@ -127,6 +129,17 @@ namespace RageCoop.Core
|
||||
// Write RadioStation
|
||||
byteArray.Add(RadioStation);
|
||||
|
||||
// Write LicensePlate
|
||||
while (LicensePlate.Length<8)
|
||||
{
|
||||
LicensePlate+=" ";
|
||||
}
|
||||
if (LicensePlate.Length>8)
|
||||
{
|
||||
LicensePlate=new string(LicensePlate.Take(8).ToArray());
|
||||
}
|
||||
byteArray.AddRange(Encoding.ASCII.GetBytes(LicensePlate));
|
||||
|
||||
byte[] result = byteArray.ToArray();
|
||||
|
||||
message.Write(result.Length);
|
||||
@ -216,6 +229,8 @@ namespace RageCoop.Core
|
||||
|
||||
// Read RadioStation
|
||||
RadioStation=reader.ReadByte();
|
||||
|
||||
LicensePlate=Encoding.ASCII.GetString(reader.ReadByteArray(8));
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user