From da32297cfb5cffc48cd6069fb8564a12964b3d3e Mon Sep 17 00:00:00 2001 From: balbo Date: Tue, 4 Aug 2020 13:59:17 +0200 Subject: [PATCH] =?UTF-8?q?waffenlager=20entnahme=20wenn=20spieler=20nicht?= =?UTF-8?q?=20mehr=20in=20der=20n=C3=A4he=20+=20wt=20meldung=20beim=20bela?= =?UTF-8?q?den?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Events/UpdateCharacterWeapon.cs | 12 +++++++++++- .../WeaponDeal/WeaponDealManager.cs | 4 +++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ReallifeGamemode.Server/Events/UpdateCharacterWeapon.cs b/ReallifeGamemode.Server/Events/UpdateCharacterWeapon.cs index 1cb468c6..d7dd96c6 100644 --- a/ReallifeGamemode.Server/Events/UpdateCharacterWeapon.cs +++ b/ReallifeGamemode.Server/Events/UpdateCharacterWeapon.cs @@ -1,8 +1,10 @@ -using System.Linq; +using System; +using System.Linq; using GTANetworkAPI; using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Models; using ReallifeGamemode.Server.Extensions; +using ReallifeGamemode.Server.Managers; namespace ReallifeGamemode.Server.Events { @@ -54,6 +56,14 @@ namespace ReallifeGamemode.Server.Events [RemoteEvent("saveWeaponSelection")] public void SaveWeaponSelection(Player client, string primaryModel, string secondaryModel, string meleeModel, string specialModel, string armor) { + WeaponPoint nearestWeapon = PositionManager.WeaponPoints.Find(w => w.Position.DistanceTo(client.Position) <= 1.5 && w.FactionId == client.GetUser().FactionId); + + if (nearestWeapon == null) + { + client.SendChatMessage("~y~Du bist nicht mehr an deinem Waffenschrank!"); + return; + } + client.RemoveAllWeapons(); if (!uint.TryParse(primaryModel, out uint primary)) { diff --git a/ReallifeGamemode.Server/WeaponDeal/WeaponDealManager.cs b/ReallifeGamemode.Server/WeaponDeal/WeaponDealManager.cs index 5ea63e0e..af93e062 100644 --- a/ReallifeGamemode.Server/WeaponDeal/WeaponDealManager.cs +++ b/ReallifeGamemode.Server/WeaponDeal/WeaponDealManager.cs @@ -82,7 +82,7 @@ namespace ReallifeGamemode.Server.WeaponDeal break; case 4: - msg = "Die russische Mafia kann uns mit östliche Importe beliefern."; + msg = "Die russische Mafia kann uns mit östlichen Importen beliefern."; break; case 5: @@ -212,6 +212,8 @@ namespace ReallifeGamemode.Server.WeaponDeal VehicleItem item6 = new VehicleItem() { ItemId = 11, VehicleId = factionVehicle.Id, Amount = 2 * oMembers }; //Stungun InventoryManager.AddItemToVehicleInventory(fVeh, item6.ItemId, item6.Amount); } + + client.SendChatMessage("~y~[WAFFENDEAL] ~w~Transporter erfolgreich beladen"); } } }