policet ab jetzt asservatentruck

This commit is contained in:
hydrant
2021-06-10 09:56:26 +02:00
parent 3af4750149
commit 4eaf6c74d9
3 changed files with 16 additions and 14 deletions

View File

@@ -224,10 +224,10 @@ namespace ReallifeGamemode.Server.Events
if (player.IsInVehicle
&& player.VehicleSeat == 0
&& player.Vehicle.Model == (uint)VehicleHash.Riot
&& player.Vehicle.Model == (uint)HanfManager.ASSERVATENTRUCK_VEHICLE
&& (user.FactionId == 1 || user.FactionId == 3)
&& player.Position.DistanceTo(HanfManager.ASSERVATENKAMMER_POSITION) <= 3
/*&& player.IsDuty()*/)
&& player.IsDuty())
{
using var dbContext = new DatabaseContext();
GTANetworkAPI.Vehicle veh = player.Vehicle;
@@ -236,7 +236,7 @@ namespace ReallifeGamemode.Server.Events
List<VehicleItem> items = InventoryManager.GetVehicleItems(veh);
if (items.Count() == 0)
{
player.SendNotification("Der Riot ist leer");
player.SendNotification("Der Asservatentruck ist leer");
return;
}
@@ -254,7 +254,7 @@ namespace ReallifeGamemode.Server.Events
var price = cannabisSeedAmount * cannabisSeedItem.PriceForConfiscation + cannabisAmount * cannabisItem.PriceForConfiscation;
logger.LogInformation("Player {0} unloaded the riot truck with {1} cannabis and {2} cannabis seed and the faction got {3}", player.Name, cannabisAmount, cannabisSeedAmount, price);
logger.LogInformation("Player {0} unloaded the asservatentruck with {1} cannabis and {2} cannabis seed and the faction got {3}", player.Name, cannabisAmount, cannabisSeedAmount, price);
var factions = dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Id == 1 || f.Id == 3);
foreach (var faction in factions)
@@ -262,7 +262,7 @@ namespace ReallifeGamemode.Server.Events
faction.BankAccount.Balance += price;
}
player.SendNotification("~g~Der Riot wurde erfolgreich entladen");
player.SendNotification("~g~Der Asservatentruck wurde erfolgreich entladen");
ChatService.HQMessage($"{player.Name} hat den Asservatentruck entladen");
@@ -805,13 +805,13 @@ namespace ReallifeGamemode.Server.Events
if (player.HasData("IsCarryingPlant") || player.GetData<bool>("IsCarryingPlant") && (user.FactionId == 3 || user.FactionId == 1) && player.IsDuty())
{
using var dbContext = new DatabaseContext();
FactionVehicle riot = dbContext.FactionVehicles.Where(f => f.Model == VehicleHash.Riot).ToList().Where(f => f.GetOwners().Contains(3)).FirstOrDefault();
if (riot == null)
FactionVehicle asservatentruckVehicle = dbContext.FactionVehicles.Where(f => f.Model == HanfManager.ASSERVATENTRUCK_VEHICLE).ToList().Where(f => f.GetOwners().Contains(3)).FirstOrDefault();
if (asservatentruckVehicle == null)
{
return;
}
GTANetworkAPI.Vehicle riotVehicle = VehicleManager.GetVehicleFromServerVehicle(riot);
if (riotVehicle.Position.DistanceTo(player.Position) > 3)
GTANetworkAPI.Vehicle asservatentruckServerVehicle = VehicleManager.GetVehicleFromServerVehicle(asservatentruckVehicle);
if (asservatentruckServerVehicle.Position.DistanceTo(player.Position) > 3)
{
return;
}
@@ -828,11 +828,11 @@ namespace ReallifeGamemode.Server.Events
IItem itemToGive = currentModel == 3 ? (IItem)cannabisItem : cannabisSeedsItem;
logger.LogInformation("Cop {0} put the item {1} ({2}, amount: {3}) in the riot", player.Name, itemToGive.Name, itemToGive.Id, amountToGive);
logger.LogInformation("Cop {0} put the item {1} ({2}, amount: {3}) in the asservatentruck", player.Name, itemToGive.Name, itemToGive.Id, amountToGive);
player.SendNotification($"Du hast {(currentModel == 3 ? "das Cannabis" : "die Samen")} in den Riot geladen");
player.SendNotification($"Du hast {(currentModel == 3 ? "das Cannabis" : "die Samen")} in den Asservatentruck geladen");
InventoryManager.AddItemToVehicleInventory(riotVehicle, itemIdToGive, amountToGive);
InventoryManager.AddItemToVehicleInventory(asservatentruckServerVehicle, itemIdToGive, amountToGive);
}
}