Merge branch 'feature/onlinelist' into develop

This commit is contained in:
hydrant
2021-04-19 01:55:38 +02:00
7 changed files with 480 additions and 16 deletions

View File

@@ -453,7 +453,7 @@ namespace ReallifeGamemode.Server.Events
int amount = 0;
var tempFactionWeapon = weapons.Where(f => f.WeaponModel == weapon).FirstOrDefault();
if(tempFactionWeapon != null)
if (tempFactionWeapon != null)
{
amount = tempFactionWeapon.Ammount;
}
@@ -513,7 +513,7 @@ namespace ReallifeGamemode.Server.Events
player.SendNotification("~r~Im Dienst kannst du keine Kleidung kaufen", false);
return;
}
if(JobBase.GetPlayerInJob().Contains(player))
if (JobBase.GetPlayerInJob().Contains(player))
{
player.SendNotification("~r~Im aktiven Job kannst du keine Kleidung kaufen", false);
return;
@@ -686,12 +686,18 @@ namespace ReallifeGamemode.Server.Events
List<Player> players = NAPI.Pools.GetAllPlayers().Where(p => p.IsLoggedIn() == true).OrderBy(o => o.Handle.Value).ToList();
var listPlayers = players.Select(p => new
var listPlayers = players.Select(p =>
{
Id = p.Handle.Value,
p.Name,
p.Ping,
FactionName = p.GetUser()?.Faction?.Name ?? "Zivilist",
User u = p.GetUser();
return new
{
Id = p.Handle.Value,
p.Name,
p.Ping,
FactionName = u?.Faction?.Name ?? "Zivilist",
FactionId = u?.FactionId ?? 0
};
});
player.TriggerEvent("showPlayerlist", JsonConvert.SerializeObject(listPlayers));
}