Fixed EF error, edit commands, fix faction broadcast
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
using GTANetworkAPI;
|
||||
using reallife_gamemode.Model;
|
||||
using reallife_gamemode.Server.Entities;
|
||||
using reallife_gamemode.Server.Extensions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
/**
|
||||
@@ -27,12 +29,22 @@ namespace reallife_gamemode.Server.Services
|
||||
|
||||
public static void BroadcastFaction(string message, List<Faction> factions)
|
||||
{
|
||||
using(var dbCon = new DatabaseContext())
|
||||
using (var dbCon = new DatabaseContext())
|
||||
{
|
||||
foreach(User u in dbCon.Users)
|
||||
foreach (User u in dbCon.Users)
|
||||
{
|
||||
Client c = ClientService.GetClientByName(u.Name);
|
||||
if (c != null && factions.Contains(u.Faction)) c.SendChatMessage(message);
|
||||
if (c != null)
|
||||
{
|
||||
Faction f = c.GetFaction();
|
||||
if (f != null)
|
||||
{
|
||||
if (factions.Find(fT => fT.Id == f.Id) != null)
|
||||
{
|
||||
c.SendChatMessage(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user