[*] Fixed Vehicle Invetory
This commit is contained in:
@@ -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) {
|
||||
|
||||
|
||||
@@ -30,9 +30,8 @@ namespace ReallifeGamemode.Server.Events
|
||||
List<int> iAmount = new List<int>();
|
||||
List<int> iId = new List<int>();
|
||||
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(),
|
||||
@@ -60,10 +59,11 @@ namespace ReallifeGamemode.Server.Events
|
||||
};
|
||||
vehicleInventory.Add(vehInv);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
client.TriggerEvent("setVehiclesInventory", vehicleInventory.ToArray());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<int[]>(jsonOrigin);
|
||||
var itemID = JsonConvert.DeserializeObject<int>(jsonItemID);
|
||||
var itemAmount = JsonConvert.DeserializeObject<int>(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<int>(jsonAmount);
|
||||
int itemId = JsonConvert.DeserializeObject<int>(jsonItemId);
|
||||
|
||||
Reference in New Issue
Block a user