waffenlager entnahme wenn spieler nicht mehr in der nähe + wt meldung beim beladen

This commit is contained in:
2020-08-04 13:59:17 +02:00
parent d969bc56c9
commit da32297cfb
2 changed files with 14 additions and 2 deletions

View File

@@ -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))
{