[+] Add /release Command to get Prisoners out of Jail

This commit is contained in:
Lukas Moungos
2019-07-19 22:01:14 +02:00
parent 409a8bc52a
commit 2a3d97265b
3 changed files with 60 additions and 4 deletions

View File

@@ -1,9 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GTANetworkAPI;
using ReallifeGamemode.Server.Entities;
using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Factions.Medic;
using ReallifeGamemode.Server.Models;
namespace ReallifeGamemode.Server.Wanted
@@ -50,7 +52,11 @@ namespace ReallifeGamemode.Server.Wanted
if (rndInt == 3)
NAPI.Player.SpawnPlayer(client, new Vector3(458.3372, -1001.258, 24.91485)); //send client to jail
client.TriggerEvent("onPlayerRevived");
MedicTask task = Medic.ReviveTasks.FirstOrDefault(t => t.Victim == client.Name);
Medic.RemoveTaskFromList(task);
client.Health = 100;
using (var dbContext = new DatabaseContext())
{
client.GetUser(dbContext).JailTime = user.Wanteds * 54; // 54 sec for each wanted star -> in total 45min for 50 Wanteds
@@ -147,6 +153,7 @@ namespace ReallifeGamemode.Server.Wanted
player.GetUser(dbContext).JailTime -= 60;
dbContext.SaveChanges();
}
player.Health = 100;
}
}