36 lines
940 B
C#
36 lines
940 B
C#
using GTANetworkAPI;
|
|
using reallife_gamemode.Model;
|
|
using reallife_gamemode.Server.Entities;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
/**
|
|
* @overview Life of German Reallife - Client Extension (ClientExtension.cs)
|
|
* @author hydrant
|
|
* @copyright (c) 2008 - 2018 Life of German
|
|
*/
|
|
|
|
namespace reallife_gamemode.Server.Extensions
|
|
{
|
|
public static class ClientExtension
|
|
{
|
|
public static User GetUser(this Client client)
|
|
{
|
|
using(DatabaseContext dbContext = new DatabaseContext())
|
|
{
|
|
return dbContext.Users.FirstOrDefault(u => u.Name == client.Name);
|
|
}
|
|
}
|
|
|
|
public static Faction GetFaction(this Client client)
|
|
{
|
|
using (DatabaseContext dbContext = new DatabaseContext())
|
|
{
|
|
return dbContext.Factions.Find(client.GetUser().Faction);
|
|
}
|
|
}
|
|
}
|
|
}
|