[*] Fix Autojail on death.

+ Added HQ message for wanteds
This commit is contained in:
Lukas Moungos
2019-07-19 21:23:58 +02:00
parent 80a04a2ee4
commit 409a8bc52a
4 changed files with 30 additions and 13 deletions

View File

@@ -37,18 +37,20 @@ namespace ReallifeGamemode.Server.Wanted
User cop = copClient.GetUser();
if (cop?.FactionId == 1 || cop?.FactionId == 3)
{
if (cop.GetData<bool>("duty") && copClient.Position.DistanceTo2D(copClient.Position) <= 200)
if (cop.GetData<bool>("duty") && copClient.Position.DistanceTo2D(copClient.Position) <= 200 && (!copClient.HasData("isDead") || copClient.GetData("isDead") != true))
{
client.SetData("isDead", false);
client.RemoveAllWeapons();
Random rnd = new Random();
int rndInt = rnd.Next(1, 3);
if (rndInt == 1)
client.Position = new Vector3(458.9842, -997.2126, 24.91485); //send client to jail
NAPI.Player.SpawnPlayer(client, new Vector3(458.9842, -997.2126, 24.91485)); //send client to jail
if (rndInt == 2)
client.Position = new Vector3(459.696, -994.3766, 24.91486); //send client to jail
NAPI.Player.SpawnPlayer(client, new Vector3(459.696, -994.3766, 24.91486)); //send client to jail
if (rndInt == 3)
client.Position = new Vector3(458.3372, -1001.258, 24.91485); //send client to jail
NAPI.Player.SpawnPlayer(client, new Vector3(458.3372, -1001.258, 24.91485)); //send client to jail
using (var dbContext = new DatabaseContext())
{
client.GetUser(dbContext).JailTime = user.Wanteds * 54; // 54 sec for each wanted star -> in total 45min for 50 Wanteds
@@ -86,7 +88,7 @@ namespace ReallifeGamemode.Server.Wanted
foreach (var copPlayer in NAPI.Pools.GetAllPlayers())
{
User cop = copPlayer.GetUser();
if (cop.GetData<bool>("duty") && copPlayer.Position.DistanceTo2D(player.Position) <= 500)
if (cop.GetData<bool>("duty") && copPlayer.Position.DistanceTo2D(player.Position) <= 500 && (!copPlayer.HasData("isDead") || copPlayer.GetData("isDead") != true))
{
if (player.Position.DistanceTo2D(new Vector3(458.9842, -997.2126, 24.91485)) <= 7)
{