add Checkpoint Update Sani
This commit is contained in:
@@ -17,7 +17,7 @@ export default function factionInteraction(globalData: IGlobalData) {
|
||||
var sorting = 0;
|
||||
var firstSorting = true;
|
||||
var activeTask = null;
|
||||
var activeCheckpoint;
|
||||
var activeCheckpoint: CheckpointMp;
|
||||
var taskStart;
|
||||
var taskFinish;
|
||||
var taskRange;
|
||||
@@ -427,6 +427,13 @@ export default function factionInteraction(globalData: IGlobalData) {
|
||||
}
|
||||
});
|
||||
|
||||
mp.events.add('updateHealCheckpoint', (xPos, yPos, zPos) => {
|
||||
if (activeTask && activeTask.Type == 1) {
|
||||
activeCheckpoint.setCoords(xPos, yPos, zPos, false, false, false, false);
|
||||
mp.game.ui.setNewWaypoint(xPos, yPos);
|
||||
}
|
||||
});
|
||||
|
||||
function renderMedicGui() {
|
||||
if (activeTask) {
|
||||
rangeLeft = mp.game.gameplay.getDistanceBetweenCoords(player.position.x, player.position.y, player.position.z, taskFinish.x, taskFinish.y, taskFinish.z, true).toFixed(2);
|
||||
|
||||
@@ -398,6 +398,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
ChatService.SendMessage(target, "~g~" + player.Name + " ~s~möchte dich für ~g~$" + price + " ~s~heilen. Drücke ~g~J~s~ zum Erlauben oder ~r~N ~s~zum Verbieten");
|
||||
player.SendNotification("Du hast " + target.Name + " einen Heal angeboten", false);
|
||||
target.SetData<bool>("healDecision", true);
|
||||
Medic.delHealTask(target);
|
||||
Medic.HealDecisions.Add(new Medic.HealDecision { dMedic = player, dTarget = target, dPrice = price });
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ namespace ReallifeGamemode.Server.Factions.Medic
|
||||
DateTime actualTime = DateTime.Now;
|
||||
foreach (var task in ReviveTasks)
|
||||
{
|
||||
if (task.MedicName != null)
|
||||
if (task.MedicName != "none")
|
||||
{
|
||||
var taskTimeLeft = Math.Abs((int)(((DateTimeOffset)actualTime).ToUnixTimeSeconds() - ((DateTimeOffset)task.Time).ToUnixTimeSeconds() - reviveTaskTime));
|
||||
task.TimeLeft = taskTimeLeft;
|
||||
@@ -172,6 +172,23 @@ namespace ReallifeGamemode.Server.Factions.Medic
|
||||
}
|
||||
}
|
||||
|
||||
public static void UpdateHealTaskCheckpoint()
|
||||
{
|
||||
if (HealTasks.Count != 0)
|
||||
{
|
||||
foreach(var task in HealTasks)
|
||||
{
|
||||
if(task.MedicName != "none")
|
||||
{
|
||||
var medic = PlayerService.GetPlayerByNameOrId(task.MedicName);
|
||||
var victim = PlayerService.GetPlayerByNameOrId(task.Victim);
|
||||
task.Position = victim.Position;
|
||||
medic.TriggerEvent("updateHealCheckpoint", victim.Position.X, victim.Position.Y, victim.Position.Z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[RemoteEvent("loadMedicTasks")]
|
||||
public void LoadMedicTasks(Player player, int type)
|
||||
{
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace ReallifeGamemode.Server.Util
|
||||
private static Timer timer500 = new Timer(500); //0.5 seconds timer
|
||||
private static Timer timer1000 = new Timer(1000); //1 seconds timer
|
||||
private static Timer timer2500 = new Timer(2500); //2.5 seconds timer
|
||||
private static Timer timer5000 = new Timer(5000); //5 seconds timer
|
||||
private static Timer timer10000 = new Timer(10000); // 10 second timer
|
||||
private static Timer timer60000 = new Timer(60000); //60 seconds timer
|
||||
|
||||
@@ -28,6 +29,9 @@ namespace ReallifeGamemode.Server.Util
|
||||
timer2500.Start();
|
||||
timer2500.Elapsed += Timer2500_Elapsed;
|
||||
|
||||
timer5000.Start();
|
||||
timer5000.Elapsed += Timer5000_Elapsed;
|
||||
|
||||
timer10000.Start();
|
||||
timer10000.Elapsed += Timer10000_Elapsed;
|
||||
|
||||
@@ -53,6 +57,15 @@ namespace ReallifeGamemode.Server.Util
|
||||
});
|
||||
}
|
||||
|
||||
private static void Timer5000_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
NAPI.Task.Run(() =>
|
||||
{
|
||||
Medic.UpdateHealTaskCheckpoint();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private static void Timer60000_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
NAPI.Task.Run(() =>
|
||||
|
||||
Reference in New Issue
Block a user