Add debug for Faction problem
This commit is contained in:
12
Main.cs
12
Main.cs
@@ -2,6 +2,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using GTANetworkAPI;
|
using GTANetworkAPI;
|
||||||
using reallife_gamemode.Model;
|
using reallife_gamemode.Model;
|
||||||
|
using reallife_gamemode.Server.Entities;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @overview Life of German Reallife - Main Class (Main.cs)
|
* @overview Life of German Reallife - Main Class (Main.cs)
|
||||||
@@ -28,6 +29,17 @@ namespace reallife_gamemode
|
|||||||
context.Factions.FirstOrDefault();
|
context.Factions.FirstOrDefault();
|
||||||
context.Users.FirstOrDefault();
|
context.Users.FirstOrDefault();
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
|
|
||||||
|
foreach(Faction f in context.Factions)
|
||||||
|
{
|
||||||
|
NAPI.Util.ConsoleOutput(f.Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(User u in context.Users)
|
||||||
|
{
|
||||||
|
Faction f = u.Faction;
|
||||||
|
NAPI.Util.ConsoleOutput("User: " + u.Name + " | Faction: " + (f == null ? "null" : f.Name));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,10 @@ namespace reallife_gamemode.Server.Extensions
|
|||||||
|
|
||||||
public static Faction GetFaction(this Client client)
|
public static Faction GetFaction(this Client client)
|
||||||
{
|
{
|
||||||
return client.GetUser()?.Faction ?? null;
|
using (DatabaseContext dbContext = new DatabaseContext())
|
||||||
|
{
|
||||||
|
return dbContext.Factions.Find(client.GetUser().Faction);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user