admin unjail

This commit is contained in:
2019-09-04 23:51:58 +02:00
parent cae5ceb2d1
commit f80eed6a68
2 changed files with 36 additions and 2 deletions

View File

@@ -16,6 +16,7 @@ using ReallifeGamemode.Server.Factions.Medic;
using ReallifeGamemode.Server.Models; using ReallifeGamemode.Server.Models;
using ReallifeGamemode.Server.Job; using ReallifeGamemode.Server.Job;
using ReallifeGamemode.Server.Finance; using ReallifeGamemode.Server.Finance;
using ReallifeGamemode.Server.Wanted;
/** /**
* @overview Life of German Reallife - Admin Commands (Admin.cs) * @overview Life of German Reallife - Admin Commands (Admin.cs)
@@ -352,6 +353,16 @@ namespace ReallifeGamemode.Server.Commands
#endregion #endregion
#region ALevel1 #region ALevel1
[Command("aunjail", "~m~Benutzung: ~s~/aunjail [Spieler]", GreedyArg = true)]
public void CmdAdminAunjai(Client player, string targetname)
{
Client target = ClientService.GetClientByNameOrId(targetname);
if (target == null)
return;
ReallifeGamemode.Server.Wanted.Jail.Release_Jail_Admin(player, target);
}
[Command("a", "~m~Benutzung: ~s~/a [Nachricht]", GreedyArg = true)] [Command("a", "~m~Benutzung: ~s~/a [Nachricht]", GreedyArg = true)]
public void CmdAdminA(Client player, string message) public void CmdAdminA(Client player, string message)
{ {

View File

@@ -174,8 +174,6 @@ namespace ReallifeGamemode.Server.Wanted
} }
} }
[RemoteEvent("setPrisonerFree")] [RemoteEvent("setPrisonerFree")]
public void Release_Jail(Client cop, string client) public void Release_Jail(Client cop, string client)
{ {
@@ -206,6 +204,31 @@ namespace ReallifeGamemode.Server.Wanted
} }
} }
} }
public static void Release_Jail_Admin(Client admin, Client target)
{
User user = target.GetUser();
if (Jailtime.ContainsKey(user.Id))
{
Jailtime.Remove(user.Id);
using (var dbContext = new DatabaseContext())
{
target.GetUser(dbContext).JailTime = 0;
dbContext.SaveChanges();
}
target.Health = 100;
target.Position = new Vector3(461.7256, -988.6035, 24.91487);
foreach (var copPlayer in NAPI.Pools.GetAllPlayers())
{
User copUser = copPlayer.GetUser();
if ((copUser.FactionId == 1 || copUser.FactionId == 3))
{
ChatService.SendMessage(copPlayer, "!{#8181E9}HQ: Admin " + admin.Name + " hat " + user.Name + " aus dem Knast entlassen.");
}
}
}
}
} }
} }