diff --git a/ReallifeGamemode.Client/assets/html/inventory/inventory.html b/ReallifeGamemode.Client/assets/html/inventory/inventory.html
index f29cfdd5..657e533e 100644
--- a/ReallifeGamemode.Client/assets/html/inventory/inventory.html
+++ b/ReallifeGamemode.Client/assets/html/inventory/inventory.html
@@ -219,9 +219,10 @@
for (i = 0; i < vehicle.ivehName.length; i++) {
var newItem = { Name: vehicle.ivehName[i], ID: vehicle.ivehId[i], Amount: vehicle.ivehAmount[i], Category: 1 };
vehInv.push(newItem);
+
+ }
Origin.push(0);
Origin.push(vehicle.ID);
- }
var jsonVehInv = JSON.stringify(vehInv);
$('#count2').html(vehInvItem[0].currentWeight / 1000);
RecieveVehicleInfo(jsonVehInv);
@@ -397,7 +398,7 @@
rucksackInv[i].Amount -= $('#tf_zahl').val();
mp.trigger("CEF:throwItem", JSON.stringify("drop"), JSON.stringify($('#tf_zahl').val()), JSON.stringify(rucksackInv[i].ID))
} else if ($('#tf_zahl').val() >= ammount) {
- mp.trigger("CEF:throwItem", JSON.stringify("drop"), JSON.stringify(0), JSON.stringify(rucksackInv[i].ID))
+ mp.trigger("CEF:throwItem", JSON.stringify("drop"), JSON.stringify(ammount), JSON.stringify(rucksackInv[i].ID))
rucksackInv.splice(i, 1);
}
@@ -457,6 +458,15 @@
event.stopPropagation()
});
$("#tf_submitZahlToVehicle").unbind('click').click(function () {
+ if (Origin.length < 2) {
+ $(".Betrag2").hide();
+ drawVehicle();
+ drawRucksack();
+ event.preventDefault()
+ event.stopPropagation()
+ return;
+ }
+
var y = parseInt($('#tf_zahl2').val(), 10);
if ($('#tf_zahl2').val() < ammount && ammount > 0) {
diff --git a/ReallifeGamemode.Server/Events/Inventory.cs b/ReallifeGamemode.Server/Events/Inventory.cs
index 9a859d07..72d2c90c 100644
--- a/ReallifeGamemode.Server/Events/Inventory.cs
+++ b/ReallifeGamemode.Server/Events/Inventory.cs
@@ -30,9 +30,8 @@ namespace ReallifeGamemode.Server.Events
List iAmount = new List();
List iId = new List();
inventoryWeight = 0;
- int vehID = 0;
- if (veh.Position.DistanceTo(client.Position) < 2)
+ if (veh.Position.DistanceTo(client.Position) < 2.5f)
{
if (VehicleStreaming.GetDoorState(veh, DoorID.DoorTrunk) == DoorState.DoorOpen)
{
@@ -47,11 +46,11 @@ namespace ReallifeGamemode.Server.Events
iName.Add(iItem.Name);
iAmount.Add(vehItem.Amount);
iId.Add(iItem.Id);
- vehID = vehItem.VehicleId;
+
}
var vehInv = new VehicleInventory
{
- ID = vehID,
+ ID = serverVehicle.Id,
currentWeight = inventoryWeight,
totalWeight = 250,
ivehName = iName.ToArray(),
@@ -59,11 +58,12 @@ namespace ReallifeGamemode.Server.Events
ivehId = iId.ToArray()
};
vehicleInventory.Add(vehInv);
- }
+ }
+ client.TriggerEvent("setVehiclesInventory", vehicleInventory.ToArray());
+ return;
}
}
- }
- client.TriggerEvent("setVehiclesInventory", vehicleInventory.ToArray());
+ }
}
}
}
diff --git a/ReallifeGamemode.Server/Managers/InventoryManager.cs b/ReallifeGamemode.Server/Managers/InventoryManager.cs
index 6f29341e..0aa081e0 100644
--- a/ReallifeGamemode.Server/Managers/InventoryManager.cs
+++ b/ReallifeGamemode.Server/Managers/InventoryManager.cs
@@ -174,7 +174,6 @@ namespace ReallifeGamemode.Server.Managers
public bool CheckOriginOfItem(Client client, string jsonItemID, string jsonItemAmount, string jsonOrigin, string jsonVehAmount)
{
- NAPI.Util.ConsoleOutput("HIER LENNART ->>>>, " + jsonOrigin);
var origin = JsonConvert.DeserializeObject(jsonOrigin);
var itemID = JsonConvert.DeserializeObject(jsonItemID);
var itemAmount = JsonConvert.DeserializeObject(jsonItemAmount);
@@ -182,11 +181,15 @@ namespace ReallifeGamemode.Server.Managers
var user = client.GetUser();
using (var context = new DatabaseContext())
{
+ if (origin.Length < 1)
+ return false;
+
+
if (origin[0] == 1)
{
foreach (Vehicle veh in NAPI.Pools.GetAllVehicles())
{
- if (veh.Position.DistanceTo(client.Position) < 2)
+ if (veh.Position.DistanceTo(client.Position) < 2.5f)
{
if (VehicleStreaming.GetDoorState(veh, DoorID.DoorTrunk) == DoorState.DoorOpen)
{
@@ -429,7 +432,7 @@ namespace ReallifeGamemode.Server.Managers
}
[RemoteEvent("itemInteract")]
- public void ItemInteract(Client player, string jsonType, string jsonItemId, string jsonAmount)
+ public void ItemInteract(Client player, string jsonType, string jsonAmount, string jsonItemId)
{
int amount = JsonConvert.DeserializeObject(jsonAmount);
int itemId = JsonConvert.DeserializeObject(jsonItemId);