46 lines
1.3 KiB
C#
46 lines
1.3 KiB
C#
using GTANetworkAPI;
|
|
using reallife_gamemode.Model;
|
|
using reallife_gamemode.Server.Entities;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
/**
|
|
* @overview Life of German Reallife - Chat Service (ChatService.cs)
|
|
* @author hydrant
|
|
* @copyright (c) 2008 - 2018 Life of German
|
|
*/
|
|
|
|
namespace reallife_gamemode.Server.Services
|
|
{
|
|
class ChatService
|
|
{
|
|
public static void NotAuthorized(Client player)
|
|
{
|
|
player.SendChatMessage("~r~[FEHLER]~s~ Du kannst diesen Befehl nicht ausführen.");
|
|
}
|
|
|
|
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 });
|
|
}
|
|
}
|
|
}
|