Continued faction system

This commit is contained in:
hydrant
2018-09-22 16:48:03 +02:00
parent bac110258d
commit 0034f29b18
6 changed files with 75 additions and 3 deletions

View File

@@ -1,4 +1,6 @@
using GTANetworkAPI;
using reallife_gamemode.Model;
using reallife_gamemode.Server.Entities;
using System;
using System.Collections.Generic;
using System.Text;
@@ -18,9 +20,26 @@ namespace reallife_gamemode.Server.Services
player.SendChatMessage("~r~[FEHLER]~s~ Du kannst diesen Befehl nicht ausführen.");
}
internal static void PlayerNotFound(Client player)
public static void PlayerNotFound(Client player)
{
player.SendChatMessage("~r~[FEHLER]~s~ Der Spieler wurde nicht gefunden.");
}
public static void BroadcastFaction(string message, List<Faction> factions)
{
using(var dbCon = new DatabaseContext())
{
foreach(User u in dbCon.Users)
{
Client c = ClientService.GetClientByName(u.Name);
if (c != null && factions.Contains(u.Faction)) c.SendChatMessage(message);
}
}
}
public static void BroadcastFaction(string message, Faction faction)
{
BroadcastFaction(message, new List<Faction> { faction });
}
}
}