Many weapons now fire bullets correctly
This commit is contained in:
@ -154,11 +154,11 @@ namespace CoopClient
|
||||
{
|
||||
Character.IsInvincible = false;
|
||||
|
||||
Function.Call(Hash.START_ENTITY_FIRE, Character);
|
||||
Function.Call(Hash.START_ENTITY_FIRE, Character.Handle);
|
||||
}
|
||||
else if (!IsOnFire && Character.IsOnFire)
|
||||
{
|
||||
Function.Call(Hash.STOP_ENTITY_FIRE, Character);
|
||||
Function.Call(Hash.STOP_ENTITY_FIRE, Character.Handle);
|
||||
|
||||
Character.IsInvincible = true;
|
||||
|
||||
@ -236,26 +236,26 @@ namespace CoopClient
|
||||
{
|
||||
if (!Character.IsInRange(Position, 0.5f))
|
||||
{
|
||||
Function.Call(Hash.TASK_GO_TO_COORD_WHILE_AIMING_AT_COORD, Character, Position.X, Position.Y,
|
||||
Position.Z, AimCoords.X, AimCoords.Y, AimCoords.Z, 3f, true, 2f, 2f, false, 0, false,
|
||||
(uint)FiringPattern.FullAuto);
|
||||
Function.Call(Hash.TASK_GO_TO_COORD_WHILE_AIMING_AT_COORD, Character.Handle, Position.X, Position.Y,
|
||||
Position.Z, AimCoords.X, AimCoords.Y, AimCoords.Z, Speed == 3 ? 3f : 2.5f, true, 0x3F000000, 0x40800000, false, 0, false,
|
||||
unchecked((int)FiringPattern.FullAuto));
|
||||
}
|
||||
else
|
||||
{
|
||||
Function.Call(Hash.TASK_SHOOT_AT_COORD, Character, AimCoords.X, AimCoords.Y, AimCoords.Z, 1500, (uint)FiringPattern.FullAuto);
|
||||
Function.Call(Hash.TASK_SHOOT_AT_COORD, Character.Handle, AimCoords.X, AimCoords.Y, AimCoords.Z, 1500, unchecked((int)FiringPattern.FullAuto));
|
||||
}
|
||||
}
|
||||
else if (IsAiming)
|
||||
{
|
||||
if (!Character.IsInRange(Position, 0.5f))
|
||||
{
|
||||
Function.Call(Hash.TASK_GO_TO_COORD_WHILE_AIMING_AT_COORD, Character, Position.X, Position.Y,
|
||||
Position.Z, AimCoords.X, AimCoords.Y, AimCoords.Z, 3f, false, 2f, 2f, false, 512, false,
|
||||
(uint)FiringPattern.FullAuto);
|
||||
Function.Call(Hash.TASK_GO_TO_COORD_WHILE_AIMING_AT_COORD, Character.Handle, Position.X, Position.Y,
|
||||
Position.Z, AimCoords.X, AimCoords.Y, AimCoords.Z, Speed == 3 ? 3f : 2.5f, false, 0x3F000000, 0x40800000, false, 512, false,
|
||||
unchecked((int)FiringPattern.FullAuto));
|
||||
}
|
||||
else
|
||||
{
|
||||
Character.Task.AimAt(AimCoords, -1);
|
||||
Character.Task.AimAt(AimCoords, 100);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -285,8 +285,8 @@ namespace CoopClient
|
||||
Character.AttachedBlip.Scale = 0.8f;
|
||||
Character.AttachedBlip.Name = username;
|
||||
|
||||
Function.Call(Hash.SET_PED_CAN_EVASIVE_DIVE, Character, false);
|
||||
Function.Call(Hash.SET_PED_GET_OUT_UPSIDE_DOWN_VEHICLE, Character, false);
|
||||
Function.Call(Hash.SET_PED_CAN_EVASIVE_DIVE, Character.Handle, false);
|
||||
Function.Call(Hash.SET_PED_GET_OUT_UPSIDE_DOWN_VEHICLE, Character.Handle, false);
|
||||
}
|
||||
|
||||
foreach (KeyValuePair<int, int> prop in Props)
|
||||
@ -320,22 +320,22 @@ namespace CoopClient
|
||||
}
|
||||
|
||||
Character.Task.GoStraightTo(predictPosition);
|
||||
Function.Call(Hash.SET_PED_DESIRED_MOVE_BLEND_RATIO, Character, nrange);
|
||||
Function.Call(Hash.SET_PED_DESIRED_MOVE_BLEND_RATIO, Character.Handle, nrange);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if ((!Character.IsRunning || range > 0.50f) && (LastMoving = true))
|
||||
{
|
||||
Character.Task.RunTo(predictPosition, true);
|
||||
Function.Call(Hash.SET_PED_DESIRED_MOVE_BLEND_RATIO, Character, 1.0f);
|
||||
Function.Call(Hash.SET_PED_DESIRED_MOVE_BLEND_RATIO, Character.Handle, 1.0f);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if ((!Character.IsSprinting || range > 0.75f) && (LastMoving = true))
|
||||
{
|
||||
Function.Call(Hash.TASK_GO_STRAIGHT_TO_COORD, Character, predictPosition.X, predictPosition.Y, predictPosition.Z, 3.0f, -1, 0.0f, 0.0f);
|
||||
Function.Call(Hash.SET_RUN_SPRINT_MULTIPLIER_FOR_PLAYER, Character, 1.49f);
|
||||
Function.Call(Hash.SET_PED_DESIRED_MOVE_BLEND_RATIO, Character, 1.0f);
|
||||
Function.Call(Hash.TASK_GO_STRAIGHT_TO_COORD, Character.Handle, predictPosition.X, predictPosition.Y, predictPosition.Z, 3.0f, -1, 0.0f, 0.0f);
|
||||
Function.Call(Hash.SET_RUN_SPRINT_MULTIPLIER_FOR_PLAYER, Character.Handle, 1.49f);
|
||||
Function.Call(Hash.SET_PED_DESIRED_MOVE_BLEND_RATIO, Character.Handle, 1.0f);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -263,7 +263,7 @@ namespace CoopClient
|
||||
{
|
||||
ArtificialLagCounter = DateTime.Now;
|
||||
|
||||
byte? flags = Util.GetPedFlags(player, FullDebugSync);
|
||||
byte? flags = Util.GetPedFlags(player, FullDebugSync, true);
|
||||
|
||||
if (FullDebugSync)
|
||||
{
|
||||
|
@ -394,7 +394,7 @@ namespace CoopClient
|
||||
Speed = Util.GetPedSpeed(player),
|
||||
AimCoords = Util.GetPedAimCoords(player, false).ToLVector(),
|
||||
CurrentWeaponHash = (int)player.Weapons.Current.Hash,
|
||||
Flag = Util.GetPedFlags(player, true)
|
||||
Flag = Util.GetPedFlags(player, true, true)
|
||||
}.PacketToNetOutGoingMessage(outgoingMessage);
|
||||
}
|
||||
else
|
||||
@ -409,7 +409,7 @@ namespace CoopClient
|
||||
Speed = Util.GetPedSpeed(player),
|
||||
AimCoords = Util.GetPedAimCoords(player, false).ToLVector(),
|
||||
CurrentWeaponHash = (int)player.Weapons.Current.Hash,
|
||||
Flag = Util.GetPedFlags(player, false)
|
||||
Flag = Util.GetPedFlags(player, false, true)
|
||||
}.PacketToNetOutGoingMessage(outgoingMessage);
|
||||
}
|
||||
|
||||
|
@ -13,18 +13,19 @@ namespace CoopClient
|
||||
{
|
||||
public static byte GetPedSpeed(Ped ped)
|
||||
{
|
||||
if (ped.IsWalking)
|
||||
if (ped.IsSprinting)
|
||||
{
|
||||
return 1;
|
||||
return 3;
|
||||
}
|
||||
else if (ped.IsRunning)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
else if (ped.IsSprinting)
|
||||
else if (ped.IsWalking)
|
||||
{
|
||||
return 3;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -34,7 +35,7 @@ namespace CoopClient
|
||||
return aimOrShoot ? (isNpc ? GetLastWeaponImpact(ped) : RaycastEverything(new Vector2(0, 0))) : new Vector3();
|
||||
}
|
||||
|
||||
public static byte? GetPedFlags(Ped ped, bool fullSync)
|
||||
public static byte? GetPedFlags(Ped ped, bool fullSync, bool isPlayer = false)
|
||||
{
|
||||
byte? flags = 0;
|
||||
|
||||
@ -48,7 +49,7 @@ namespace CoopClient
|
||||
flags |= (byte)PedDataFlags.IsAiming;
|
||||
}
|
||||
|
||||
if (ped.IsShooting && ped.Weapons.Current?.AmmoInClip != 0)
|
||||
if ((ped.IsShooting || isPlayer && Game.IsControlPressed(Control.Attack)) && ped.Weapons.Current?.AmmoInClip != 0)
|
||||
{
|
||||
flags |= (byte)PedDataFlags.IsShooting;
|
||||
}
|
||||
|
Reference in New Issue
Block a user