Move CurrentWeaponHash to full sync
This commit is contained in:
@ -337,7 +337,6 @@ namespace RageCoop.Client
|
|||||||
c.Rotation = packet.Rotation;
|
c.Rotation = packet.Rotation;
|
||||||
c.Velocity = packet.Velocity;
|
c.Velocity = packet.Velocity;
|
||||||
c.Speed = packet.Speed;
|
c.Speed = packet.Speed;
|
||||||
c.CurrentWeaponHash = packet.CurrentWeaponHash;
|
|
||||||
c.IsAiming = flags.HasPedFlag(PedDataFlags.IsAiming);
|
c.IsAiming = flags.HasPedFlag(PedDataFlags.IsAiming);
|
||||||
c.IsReloading = flags.HasPedFlag(PedDataFlags.IsReloading);
|
c.IsReloading = flags.HasPedFlag(PedDataFlags.IsReloading);
|
||||||
c.IsJumping = flags.HasPedFlag(PedDataFlags.IsJumping);
|
c.IsJumping = flags.HasPedFlag(PedDataFlags.IsJumping);
|
||||||
@ -364,6 +363,7 @@ namespace RageCoop.Client
|
|||||||
}
|
}
|
||||||
if (packet.Flags.HasPedFlag(PedDataFlags.IsFullSync))
|
if (packet.Flags.HasPedFlag(PedDataFlags.IsFullSync))
|
||||||
{
|
{
|
||||||
|
c.CurrentWeaponHash = packet.CurrentWeaponHash;
|
||||||
c.Clothes=packet.Clothes;
|
c.Clothes=packet.Clothes;
|
||||||
c.WeaponComponents=packet.WeaponComponents;
|
c.WeaponComponents=packet.WeaponComponents;
|
||||||
c.WeaponTint=packet.WeaponTint;
|
c.WeaponTint=packet.WeaponTint;
|
||||||
|
@ -41,7 +41,6 @@ namespace RageCoop.Client
|
|||||||
Rotation = p.ReadRotation(),
|
Rotation = p.ReadRotation(),
|
||||||
Velocity = p.ReadVelocity(),
|
Velocity = p.ReadVelocity(),
|
||||||
Speed = p.GetPedSpeed(),
|
Speed = p.GetPedSpeed(),
|
||||||
CurrentWeaponHash = (uint)p.Weapons.Current.Hash,
|
|
||||||
Flags = p.GetPedFlags(),
|
Flags = p.GetPedFlags(),
|
||||||
Heading=p.Heading,
|
Heading=p.Heading,
|
||||||
};
|
};
|
||||||
@ -62,6 +61,14 @@ namespace RageCoop.Client
|
|||||||
c.LastSentStopWatch.Restart();
|
c.LastSentStopWatch.Restart();
|
||||||
if (full)
|
if (full)
|
||||||
{
|
{
|
||||||
|
if (packet.Flags.HasPedFlag(PedDataFlags.IsInVehicle))
|
||||||
|
{
|
||||||
|
packet.CurrentWeaponHash=(uint)p.VehicleWeapon;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
packet.CurrentWeaponHash=(uint)p.Weapons.Current.Hash;
|
||||||
|
}
|
||||||
packet.Flags |= PedDataFlags.IsFullSync;
|
packet.Flags |= PedDataFlags.IsFullSync;
|
||||||
packet.Clothes=p.GetPedClothes();
|
packet.Clothes=p.GetPedClothes();
|
||||||
packet.ModelHash=p.Model.Hash;
|
packet.ModelHash=p.Model.Hash;
|
||||||
|
@ -44,13 +44,11 @@ namespace RageCoop.Client
|
|||||||
LastSynced=Main.Ticked;
|
LastSynced=Main.Ticked;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region PLAYER -- ONLY
|
|
||||||
internal Blip PedBlip = null;
|
internal Blip PedBlip = null;
|
||||||
internal BlipColor BlipColor = (BlipColor)255;
|
internal BlipColor BlipColor = (BlipColor)255;
|
||||||
internal BlipSprite BlipSprite = (BlipSprite)0;
|
internal BlipSprite BlipSprite = (BlipSprite)0;
|
||||||
internal float BlipScale = 1;
|
internal float BlipScale = 1;
|
||||||
internal Player Player;
|
internal Player Player;
|
||||||
#endregion
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Indicates whether this ped is a player
|
/// Indicates whether this ped is a player
|
||||||
@ -165,7 +163,6 @@ namespace RageCoop.Client
|
|||||||
{
|
{
|
||||||
SetClothes();
|
SetClothes();
|
||||||
}
|
}
|
||||||
CheckCurrentWeapon();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -341,6 +338,7 @@ namespace RageCoop.Client
|
|||||||
|
|
||||||
private void DisplayOnFoot()
|
private void DisplayOnFoot()
|
||||||
{
|
{
|
||||||
|
CheckCurrentWeapon();
|
||||||
if (IsInParachuteFreeFall)
|
if (IsInParachuteFreeFall)
|
||||||
{
|
{
|
||||||
MainPed.PositionNoOffset = Vector3.Lerp(MainPed.ReadPosition(), Position + Velocity, 0.5f);
|
MainPed.PositionNoOffset = Vector3.Lerp(MainPed.ReadPosition(), Position + Velocity, 0.5f);
|
||||||
@ -588,11 +586,11 @@ namespace RageCoop.Client
|
|||||||
#region WEAPON
|
#region WEAPON
|
||||||
private void CheckCurrentWeapon()
|
private void CheckCurrentWeapon()
|
||||||
{
|
{
|
||||||
|
if (!WeaponAsset.IsLoaded) { WeaponAsset.Request(); }
|
||||||
if (MainPed.Weapons.Current.Hash != (WeaponHash)CurrentWeaponHash || !WeaponComponents.Compare(_lastWeaponComponents))
|
if (MainPed.Weapons.Current.Hash != (WeaponHash)CurrentWeaponHash || !WeaponComponents.Compare(_lastWeaponComponents))
|
||||||
{
|
{
|
||||||
if (WeaponAsset!=null) { WeaponAsset.MarkAsNoLongerNeeded(); }
|
if (WeaponAsset!=null) { WeaponAsset.MarkAsNoLongerNeeded(); }
|
||||||
WeaponAsset=new WeaponAsset(CurrentWeaponHash);
|
WeaponAsset=new WeaponAsset(CurrentWeaponHash);
|
||||||
if (!WeaponAsset.IsLoaded) { WeaponAsset.Request(); }
|
|
||||||
MainPed.Weapons.RemoveAll();
|
MainPed.Weapons.RemoveAll();
|
||||||
_lastWeaponObj = Function.Call<int>(Hash.CREATE_WEAPON_OBJECT, CurrentWeaponHash, -1, Position.X, Position.Y, Position.Z, true, 0, 0);
|
_lastWeaponObj = Function.Call<int>(Hash.CREATE_WEAPON_OBJECT, CurrentWeaponHash, -1, Position.X, Position.Y, Position.Z, true, 0, 0);
|
||||||
|
|
||||||
@ -766,9 +764,13 @@ namespace RageCoop.Client
|
|||||||
{
|
{
|
||||||
if (MainPed.IsOnTurretSeat())
|
if (MainPed.IsOnTurretSeat())
|
||||||
{
|
{
|
||||||
Function.Call(Hash.SET_VEHICLE_TURRET_SPEED_THIS_FRAME, MainPed.CurrentVehicle, 100);
|
// 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_VEHICLE_AIM_AT_COORD, MainPed.Handle, AimCoords.X, AimCoords.Y, AimCoords.Z);
|
||||||
}
|
}
|
||||||
|
if (MainPed.VehicleWeapon!=(VehicleWeaponHash)CurrentWeaponHash)
|
||||||
|
{
|
||||||
|
MainPed.VehicleWeapon=(VehicleWeaponHash)CurrentWeaponHash;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
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.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);
|
Function.Call(Hash.SET_PED_STEALTH_MOVEMENT, P,true, 0);
|
||||||
|
@ -38,7 +38,6 @@ namespace RageCoop.Core
|
|||||||
|
|
||||||
public Vector3 AimCoords { get; set; }
|
public Vector3 AimCoords { get; set; }
|
||||||
|
|
||||||
public uint CurrentWeaponHash { get; set; }
|
|
||||||
|
|
||||||
public float Heading { get; set; }
|
public float Heading { get; set; }
|
||||||
|
|
||||||
@ -46,6 +45,8 @@ namespace RageCoop.Core
|
|||||||
|
|
||||||
public int ModelHash { get; set; }
|
public int ModelHash { get; set; }
|
||||||
|
|
||||||
|
public uint CurrentWeaponHash { get; set; }
|
||||||
|
|
||||||
public byte[] Clothes { get; set; }
|
public byte[] Clothes { get; set; }
|
||||||
|
|
||||||
public Dictionary<uint, bool> WeaponComponents { get; set; }
|
public Dictionary<uint, bool> WeaponComponents { get; set; }
|
||||||
@ -99,8 +100,6 @@ namespace RageCoop.Core
|
|||||||
// Write ped speed
|
// Write ped speed
|
||||||
byteArray.Add(Speed);
|
byteArray.Add(Speed);
|
||||||
|
|
||||||
// Write ped weapon hash
|
|
||||||
byteArray.AddRange(BitConverter.GetBytes(CurrentWeaponHash));
|
|
||||||
|
|
||||||
if (Flags.HasPedFlag(PedDataFlags.IsAiming))
|
if (Flags.HasPedFlag(PedDataFlags.IsAiming))
|
||||||
{
|
{
|
||||||
@ -115,6 +114,9 @@ namespace RageCoop.Core
|
|||||||
// Write model hash
|
// Write model hash
|
||||||
byteArray.AddInt(ModelHash);
|
byteArray.AddInt(ModelHash);
|
||||||
|
|
||||||
|
// Write ped weapon hash
|
||||||
|
byteArray.AddUint(CurrentWeaponHash);
|
||||||
|
|
||||||
byteArray.AddRange(Clothes);
|
byteArray.AddRange(Clothes);
|
||||||
|
|
||||||
// Write player weapon components
|
// Write player weapon components
|
||||||
@ -185,8 +187,6 @@ namespace RageCoop.Core
|
|||||||
// Read player speed
|
// Read player speed
|
||||||
Speed = reader.ReadByte();
|
Speed = reader.ReadByte();
|
||||||
|
|
||||||
// Read player weapon hash
|
|
||||||
CurrentWeaponHash = reader.ReadUInt32();
|
|
||||||
|
|
||||||
// Try to read aim coords
|
// Try to read aim coords
|
||||||
if (Flags.HasPedFlag(PedDataFlags.IsAiming))
|
if (Flags.HasPedFlag(PedDataFlags.IsAiming))
|
||||||
@ -202,6 +202,9 @@ namespace RageCoop.Core
|
|||||||
// Read player model hash
|
// Read player model hash
|
||||||
ModelHash = reader.ReadInt32();
|
ModelHash = reader.ReadInt32();
|
||||||
|
|
||||||
|
// Read player weapon hash
|
||||||
|
CurrentWeaponHash = reader.ReadUInt32();
|
||||||
|
|
||||||
// Read player clothes
|
// Read player clothes
|
||||||
Clothes =reader.ReadBytes(36);
|
Clothes =reader.ReadBytes(36);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user