[+] Add /release Command to get Prisoners out of Jail
This commit is contained in:
@@ -209,7 +209,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
}
|
||||
|
||||
User targetCop = target.GetUser();
|
||||
if(targetCop.FactionId == 1 || targetCop.FactionId == 2)
|
||||
if(targetCop.FactionId == 1 || targetCop.FactionId == 3)
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Du kannst dieser Person keine Wanteds geben");
|
||||
return;
|
||||
@@ -223,7 +223,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
{
|
||||
|
||||
User user = player.GetUser();
|
||||
if (user == null || (user.FactionId != 1 && user.FactionId != 2))
|
||||
if (user == null || (user.FactionId != 1 && user.FactionId != 3))
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
@@ -249,6 +249,55 @@ namespace ReallifeGamemode.Server.Commands
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
[Command("release", "~m~Benutzung: ~s~/release [Name / ID] [Grund]")]
|
||||
public void CmdFactionJailRelease(Client player, string nameOrId, string reason)
|
||||
{
|
||||
User user = player.GetUser();
|
||||
if (user == null || (user.FactionId != 1 && user.FactionId != 3))
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
|
||||
Client target = ClientService.GetClientByNameOrId(nameOrId);
|
||||
if (target == null || !target.IsLoggedIn())
|
||||
{
|
||||
ChatService.PlayerNotFound(player);
|
||||
return;
|
||||
}
|
||||
|
||||
User targetCop = target.GetUser();
|
||||
if (targetCop.FactionId == 1 || targetCop.FactionId == 3)
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Diese Person sollte sich nicht im Knast befinden");
|
||||
return;
|
||||
}
|
||||
if(target.Position.DistanceTo(player.Position) < 6)
|
||||
{
|
||||
User targetUser = target.GetUser();
|
||||
if (targetUser.JailTime > 0)
|
||||
{
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
target.GetUser(dbContext).JailTime = 0;
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Diese Person befindet sich nicht im Knast");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Du bist zu weit entfernt");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
#region Global Fraktions Commands
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user