This commit is contained in:
VegaZ
2021-04-11 23:59:14 +02:00
parent e0a34d8f00
commit 016eacf709
3 changed files with 32 additions and 0 deletions

View File

@@ -0,0 +1 @@


View File

@@ -235,6 +235,7 @@ namespace ReallifeGamemode.Server.Events
ItemshopPoint nearestItemShopPoint = PositionManager.itemshopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5);
JobPoint nearestJobPoint = PositionManager.JobPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.6);
Player nearestCuffPlayer = PositionManager.cuffPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.6 && user.GetData<bool>("duty"));
AmmunationPoint nearestAmmunationPoint = PositionManager.AmmunationPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5);
if (user?.FactionId != null)
{
@@ -516,6 +517,10 @@ namespace ReallifeGamemode.Server.Events
{
nearestFriseurPoint.friseurShop.LoadShopNUI(player);
}
if (nearestAmmunationPoint != null)
{
nearestAmmunationPoint.Ammunation.LoadShopNUI(player);
}
if (user.FactionLeader)
{
player.TriggerEvent("CLIENT:StartGangwar");

View File

@@ -3,8 +3,10 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using GTANetworkAPI;
using Newtonsoft.Json;
using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Extensions;
namespace ReallifeGamemode.Server.Shop.Ammunation
{
@@ -26,6 +28,30 @@ namespace ReallifeGamemode.Server.Shop.Ammunation
weaponList = dbContext.Weapons.ToList();
}
}
public void LoadShopNUI(Player client)
{
User u = client.GetUser();
if (u == null)
{
return;
}
//List<Weapon> melee = weaponList.ToList().FindAll(w => w.Category == "Pistol");
List<Weapon> handguns = weaponList.ToList().FindAll(w => w.Category == "Handgun");
//List<Weapon> smgs = weaponList.ToList().FindAll(w => w.Category == "SMG");
//List<Weapon> shotguns = weaponList.ToList().FindAll(w => w.Category == "Shotgun");
//List<Weapon> assaultrifles = weaponList.ToList().FindAll(w => w.Category == "AssaultRifle");
//List<Weapon> lmgs = weaponList.ToList().FindAll(w => w.Category == "LMG");
//List<Weapon> sniperrifles = weaponList.ToList().FindAll(w => w.Category == "SniperRifle");
//List<Weapon> heavyweapons = weaponList.ToList().FindAll(w => w.Category == "HeavyWeapon");
//List<Weapon> throwables = weaponList.ToList().FindAll(w => w.Category == "Throwables");
List<Array> shopWeapons = new List<Array>
{
handguns.ToArray(),
};
client.TriggerEvent("AmmunationShop:LoadNativeUI", JsonConvert.SerializeObject(shopWeapons));
}
}
}