[*] Fixed Vehicle Invetory
This commit is contained in:
@@ -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(),
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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