NotificationService für Fehler rein
This commit is contained in:
@@ -8,6 +8,7 @@ using ReallifeGamemode.Server.Extensions;
|
||||
using ReallifeGamemode.Server.Inventory.Interfaces;
|
||||
using ReallifeGamemode.Server.Log;
|
||||
using ReallifeGamemode.Server.Managers;
|
||||
using ReallifeGamemode.Server.Services;
|
||||
using ReallifeGamemode.Server.Util;
|
||||
|
||||
namespace ReallifeGamemode.Server.Inventory
|
||||
@@ -21,10 +22,10 @@ namespace ReallifeGamemode.Server.Inventory
|
||||
public Vector3 Position { get; set; }
|
||||
|
||||
public static List<GroundItem> GroundItems = new List<GroundItem>();
|
||||
public static List<GTANetworkAPI.Object> GroundObjects = new List<GTANetworkAPI.Object>();
|
||||
public static List<Object> GroundObjects = new List<Object>();
|
||||
public static List<TextLabel> GroundTextLabels = new List<TextLabel>();
|
||||
|
||||
public static void AddGroundItem(GroundItem grndItem, GTANetworkAPI.Object grndObject, TextLabel grndTextLabel)
|
||||
public static void AddGroundItem(GroundItem grndItem, Object grndObject, TextLabel grndTextLabel)
|
||||
{
|
||||
GroundItems.Add(grndItem);
|
||||
GroundObjects.Add(grndObject);
|
||||
@@ -38,13 +39,16 @@ namespace ReallifeGamemode.Server.Inventory
|
||||
{
|
||||
var invWeight = InventoryManager.GetUserInventoryWeight(player);
|
||||
var itemsToAdd = 0;
|
||||
GTANetworkAPI.Object nearestObject = GroundObjects.FirstOrDefault(d => d.Position == nearest.Position);
|
||||
Object nearestObject = GroundObjects.FirstOrDefault(d => d.Position == nearest.Position);
|
||||
TextLabel nearestTextLabel = GroundTextLabels.FirstOrDefault(d => d.Position == new Vector3(nearest.Position.X, nearest.Position.Y, nearest.Position.Z + 1.05) || d.Position == new Vector3(nearest.Position.X, nearest.Position.Y, nearest.Position.Z + 0.8) || d.Position == nearest.Position);
|
||||
IItem nearestItem = InventoryManager.GetItemById(nearest.ItemId);
|
||||
UserItem existingItem = InventoryManager.UserHasThisItem(player, nearest.ItemId);
|
||||
var user = player.GetUser();
|
||||
if (player.HasAttachment("ammobox"))
|
||||
{ player.SendNotification("~r~Du kannst momentan nichts tragen!", false); return false; }
|
||||
if (player.HasAttachment("ammobox")) {
|
||||
NotificationService.SendErrorNotification(player, "Du kannst momentan nichts tragen!", false);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (nearestItem.Gewicht * nearest.Amount + invWeight > 40000)
|
||||
{
|
||||
for (var i = 1; i <= nearest.Amount; i++)
|
||||
@@ -60,7 +64,7 @@ namespace ReallifeGamemode.Server.Inventory
|
||||
}
|
||||
if (itemsToAdd < 1)
|
||||
{
|
||||
player.SendNotification("~r~Du hast keinen Platz im Inventar!", false);
|
||||
NotificationService.SendErrorNotification(player, "Du hast keinen Platz im Inventar!", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -120,7 +124,7 @@ namespace ReallifeGamemode.Server.Inventory
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void RemoveGroundItem(GroundItem grndItem, GTANetworkAPI.Object grndObject, TextLabel grndTextLabel)
|
||||
public static void RemoveGroundItem(GroundItem grndItem, Object grndObject, TextLabel grndTextLabel)
|
||||
{
|
||||
GroundItems.Remove(grndItem);
|
||||
NAPI.Entity.DeleteEntity(grndObject);
|
||||
|
||||
Reference in New Issue
Block a user