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 if (player.IsInVehicle
&& player.VehicleSeat == 0 && player.VehicleSeat == 0
&& player.Vehicle.Model == (uint)VehicleHash.Riot && player.Vehicle.Model == (uint)HanfManager.ASSERVATENTRUCK_VEHICLE
&& (user.FactionId == 1 || user.FactionId == 3) && (user.FactionId == 1 || user.FactionId == 3)
&& player.Position.DistanceTo(HanfManager.ASSERVATENKAMMER_POSITION) <= 3 && player.Position.DistanceTo(HanfManager.ASSERVATENKAMMER_POSITION) <= 3
/*&& player.IsDuty()*/) && player.IsDuty())
{ {
using var dbContext = new DatabaseContext(); using var dbContext = new DatabaseContext();
GTANetworkAPI.Vehicle veh = player.Vehicle; GTANetworkAPI.Vehicle veh = player.Vehicle;
@@ -236,7 +236,7 @@ namespace ReallifeGamemode.Server.Events
List<VehicleItem> items = InventoryManager.GetVehicleItems(veh); List<VehicleItem> items = InventoryManager.GetVehicleItems(veh);
if (items.Count() == 0) if (items.Count() == 0)
{ {
player.SendNotification("Der Riot ist leer"); player.SendNotification("Der Asservatentruck ist leer");
return; return;
} }
@@ -254,7 +254,7 @@ namespace ReallifeGamemode.Server.Events
var price = cannabisSeedAmount * cannabisSeedItem.PriceForConfiscation + cannabisAmount * cannabisItem.PriceForConfiscation; 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); var factions = dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Id == 1 || f.Id == 3);
foreach (var faction in factions) foreach (var faction in factions)
@@ -262,7 +262,7 @@ namespace ReallifeGamemode.Server.Events
faction.BankAccount.Balance += price; 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"); 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()) if (player.HasData("IsCarryingPlant") || player.GetData<bool>("IsCarryingPlant") && (user.FactionId == 3 || user.FactionId == 1) && player.IsDuty())
{ {
using var dbContext = new DatabaseContext(); using var dbContext = new DatabaseContext();
FactionVehicle riot = dbContext.FactionVehicles.Where(f => f.Model == VehicleHash.Riot).ToList().Where(f => f.GetOwners().Contains(3)).FirstOrDefault(); FactionVehicle asservatentruckVehicle = dbContext.FactionVehicles.Where(f => f.Model == HanfManager.ASSERVATENTRUCK_VEHICLE).ToList().Where(f => f.GetOwners().Contains(3)).FirstOrDefault();
if (riot == null) if (asservatentruckVehicle == null)
{ {
return; return;
} }
GTANetworkAPI.Vehicle riotVehicle = VehicleManager.GetVehicleFromServerVehicle(riot); GTANetworkAPI.Vehicle asservatentruckServerVehicle = VehicleManager.GetVehicleFromServerVehicle(asservatentruckVehicle);
if (riotVehicle.Position.DistanceTo(player.Position) > 3) if (asservatentruckServerVehicle.Position.DistanceTo(player.Position) > 3)
{ {
return; return;
} }
@@ -828,11 +828,11 @@ namespace ReallifeGamemode.Server.Events
IItem itemToGive = currentModel == 3 ? (IItem)cannabisItem : cannabisSeedsItem; 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);
} }
} }

View File

@@ -120,6 +120,8 @@ namespace ReallifeGamemode.Server.Managers
private static List<CannabisData> _currentCannabisData = new List<CannabisData>(); private static List<CannabisData> _currentCannabisData = new List<CannabisData>();
public static readonly Vector3 ASSERVATENKAMMER_POSITION = new Vector3(-5.45, -670.03, 32.33); public static readonly Vector3 ASSERVATENKAMMER_POSITION = new Vector3(-5.45, -670.03, 32.33);
public const VehicleHash ASSERVATENTRUCK_VEHICLE = VehicleHash.Policet;
static HanfManager() static HanfManager()
{ {
_manufacturerDoneTimer.Elapsed += ManufacturerDoneTimerCallback; _manufacturerDoneTimer.Elapsed += ManufacturerDoneTimerCallback;
@@ -178,7 +180,7 @@ namespace ReallifeGamemode.Server.Managers
RegeneratePrices(); RegeneratePrices();
NAPI.Marker.CreateMarker(GTANetworkAPI.MarkerType.VerticalCylinder, ASSERVATENKAMMER_POSITION.Subtract(new Vector3(0, 0, 3.0)), new Vector3(), new Vector3(), 3.0f, Colors.White); NAPI.Marker.CreateMarker(GTANetworkAPI.MarkerType.VerticalCylinder, ASSERVATENKAMMER_POSITION.Subtract(new Vector3(0, 0, 3.0)), new Vector3(), new Vector3(), 3.0f, Colors.White);
NAPI.TextLabel.CreateTextLabel("Asservatenkammer~n~Drücke ~y~E~s~, um den ~y~Riot~s~ zu entladen", ASSERVATENKAMMER_POSITION, 10.0f, 10.0f, 0, Colors.White); NAPI.TextLabel.CreateTextLabel("Asservatenkammer~n~Drücke ~y~E~s~, um den ~y~Asservatentruck~s~ zu entladen", ASSERVATENKAMMER_POSITION, 10.0f, 10.0f, 0, Colors.White);
using var dbContext = new DatabaseContext(); using var dbContext = new DatabaseContext();
HarvestRottenPlants(dbContext); HarvestRottenPlants(dbContext);

View File

@@ -359,7 +359,7 @@ namespace ReallifeGamemode.Server.Managers
if (serverVehicle is FactionVehicle factionVehicle) if (serverVehicle is FactionVehicle factionVehicle)
{ {
if (factionVehicle.Model == VehicleHash.Riot && user.Faction?.StateOwned == true) if (factionVehicle.Model == HanfManager.ASSERVATENTRUCK_VEHICLE && user.Faction?.StateOwned == true)
{ {
player.TriggerEvent("Error", "Transfer nicht möglich."); player.TriggerEvent("Error", "Transfer nicht möglich.");
return; return;