item aufheben E

This commit is contained in:
hydrant
2021-04-05 14:25:39 +02:00
parent 3bb70d112e
commit 10939c6f0c
2 changed files with 12 additions and 3 deletions

View File

@@ -198,6 +198,14 @@ namespace ReallifeGamemode.Server.Events
return;
}
if(!player.IsInVehicle)
{
if(GroundItem.PickUpGroundItem(player))
{
return;
}
}
DutyPoint nearestDuty = PositionManager.DutyPoints.Find(d => d.Position.DistanceTo(player.Position) <= 1.5 && d.FactionId == user.FactionId);
WeaponPoint nearestWeapon = PositionManager.WeaponPoints.Find(w => w.Position.DistanceTo(player.Position) <= 1.5 && w.FactionId == user.FactionId);
JailReleasePoint nearestJailReleasePoint = PositionManager.JailReleasePoints.Find(j => j.Position.DistanceTo(player.Position) <= 1.5 && (user.FactionId == 1 || user.FactionId == 3) && user.GetData<bool>("duty"));
@@ -875,8 +883,6 @@ namespace ReallifeGamemode.Server.Events
if (!player.IsInVehicle)
{
Vehicle.VehicleMenuLockCarEvent(player);
GroundItem.PickUpGroundItem(player);
}
if (player.IsInVehicle && player.VehicleSeat == 0)

View File

@@ -26,7 +26,7 @@ namespace ReallifeGamemode.Server.Inventory
GroundTextLabels.Add(grndTextLabel);
}
public static void PickUpGroundItem(Player player)
public static bool PickUpGroundItem(Player player)
{
GroundItem nearest = GroundItems.FirstOrDefault(d => d.Position.DistanceTo(player.Position) <= 1.2);
if (nearest != null)
@@ -106,7 +106,10 @@ namespace ReallifeGamemode.Server.Inventory
NAPI.Player.SetPlayerCurrentWeapon(player, WeaponHash.Unarmed);
}
}
return true;
}
return false;
}
public static void RemoveGroundItem(GroundItem grndItem, GTANetworkAPI.Object grndObject, TextLabel grndTextLabel)