This commit is contained in:
Lukas Moungos
2019-07-20 14:02:37 +02:00
parent 9630d97307
commit f80c0b7f64
2 changed files with 35 additions and 23 deletions

View File

@@ -1,5 +1,6 @@
using System; using System;
using GTANetworkAPI; using GTANetworkAPI;
using ReallifeGamemode.Server.Entities;
using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Factions.Medic; using ReallifeGamemode.Server.Factions.Medic;
using ReallifeGamemode.Server.Models; using ReallifeGamemode.Server.Models;
@@ -76,23 +77,27 @@ namespace ReallifeGamemode.Server.Events
} }
} }
User user = player.GetUser();
if(user.JailTime <= 0)
//MEDIC AUFTRAG
MedicTask reviveTask = new MedicTask()
{ {
Victim = player.Name, //MEDIC AUFTRAG
Position = player.Position, MedicTask reviveTask = new MedicTask()
CauseOfDeath = reason.ToString(), {
Caller = null, Victim = player.Name,
Description = "Gestorben", Position = player.Position,
Time = DateTime.Now, CauseOfDeath = reason.ToString(),
Type = MedicTaskType.REVIVE, Caller = null,
MedicName = "none" Description = "Gestorben",
}; Time = DateTime.Now,
Medic.AddTaskToList(reviveTask); Type = MedicTaskType.REVIVE,
MedicName = "none"
};
Medic.AddTaskToList(reviveTask);
//TODO PICTURE NOTIFICATION + SOUND für Medics
}
//TODO PICTURE NOTIFICATION + SOUND für Medics
using (var userDeath = new DatabaseContext()) using (var userDeath = new DatabaseContext())
{ {

View File

@@ -21,14 +21,22 @@ namespace ReallifeGamemode.Server.Wanted
User user = client.GetUser(); User user = client.GetUser();
if (user.JailTime > 0) if (user.JailTime > 0)
{ {
client.SetData("isDead", false);
client.RemoveAllWeapons();
Random rnd = new Random(); Random rnd = new Random();
int rndInt = rnd.Next(1, 3); int rndInt = rnd.Next(1, 3);
if (rndInt == 1) 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) 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) 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
client.TriggerEvent("onPlayerRevived");
MedicTask task = Medic.ReviveTasks.FirstOrDefault(t => t.Victim == client.Name);
Medic.RemoveTaskFromList(task);
client.Health = 100;
Jailtime[user.Id] = user.JailTime; // 54 sec for each wanted star -> in total 45min for 50 Wanteds Jailtime[user.Id] = user.JailTime; // 54 sec for each wanted star -> in total 45min for 50 Wanteds
return; return;
@@ -57,6 +65,8 @@ namespace ReallifeGamemode.Server.Wanted
dbContext.SaveChanges(); dbContext.SaveChanges();
} }
}
client.SetData("isDead", false); client.SetData("isDead", false);
client.RemoveAllWeapons(); client.RemoveAllWeapons();
Random rnd = new Random(); Random rnd = new Random();
@@ -73,11 +83,8 @@ namespace ReallifeGamemode.Server.Wanted
Medic.RemoveTaskFromList(task); Medic.RemoveTaskFromList(task);
client.Health = 100; client.Health = 100;
ChatService.BroadcastFaction("~r~HQ: " + user.Name + " wurde im Gefängnis zugewiesen.", new List<int>() { 1, 3 });
ChatService.SendMessage(client, "Du bist im Gefängnis für " + jailTime + " Sekunden."); ChatService.SendMessage(client, "Du bist im Gefängnis für " + jailTime + " Sekunden.");
ChatService.BroadcastFaction("~r~HQ: " + user.Name + " wurde ins Gefängnis geliefert.", new List<int>() {1,3});
} }
} }
} }