Fix Medic

This commit is contained in:
VegaZ
2021-04-04 15:18:30 +02:00
parent 3dd15de267
commit 1e7f2deac9
4 changed files with 53 additions and 11 deletions

View File

@@ -288,7 +288,7 @@ export default function factionInteraction(globalData: IGlobalData) {
initTasks = tasks;
}
mp.events.call("sortFactionTasks", false);
//mp.events.call("sortFactionTasks", false);
mp.gui.chat.activate(false);
globalData.InMenu = true;
@@ -329,7 +329,7 @@ export default function factionInteraction(globalData: IGlobalData) {
dimension: 0
});
reviveTaskMenuMedic.Close();
deathTime = deathSeconds[index];
deathTime = tasks[index].TimeLeft;
mp.gui.chat.activate(true);
globalData.InMenu = false;
ambulanceImagePos = 0.325
@@ -337,7 +337,7 @@ export default function factionInteraction(globalData: IGlobalData) {
taskFinish = tasks[index].Position;
taskRange = mp.game.gameplay.getDistanceBetweenCoords(player.position.x, player.position.y, player.position.z, tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z, true);
activeTask = tasks[index];
mp.events.callRemote("getTaskTimeLeft", tasks[index].Victim);
}
}
});
@@ -477,6 +477,7 @@ export default function factionInteraction(globalData: IGlobalData) {
mp.events.add("destroyMedicTaskCheckpoint", () => {
activeCheckpoint.destroy();
activeCheckpoint = null;
activeTask = null;
timeLeft = 0;
mp.events.callRemote("MedicTaskTimeout");
@@ -485,14 +486,22 @@ export default function factionInteraction(globalData: IGlobalData) {
mp.events.add('playerEnterCheckpoint', (activeCheckpoint) => {
if (deadRespawned == true) {
activeCheckpoint.destroy();
activeCheckpoint = null;
mp.events.callRemote("PayCutMedicEarnings");
activeTask = null;
deadRespawned = false;
timeLeft = 0;
} else if (activeTask.Type == 1){
activeCheckpoint.destroy();
activeCheckpoint = null;
mp.events.callRemote("delHealTaskAsMedic", activeTask.Victim);
activeTask = null;
activeTask = null;
}
});
mp.events.add('setTaskTimeLeft', (taskTimeLeft) => {
if (activeTask) {
activeTask.TimeLeft = taskTimeLeft;
}
});
@@ -521,16 +530,15 @@ export default function factionInteraction(globalData: IGlobalData) {
var currentDate = new Date();
if (deadRespawned == false) {
timeLeft = Math.round(Math.abs(Math.floor(currentDate.getTime() / 1000) - deathTime - 30));
timeLeft = Math.round(Math.abs(Math.floor(currentDate.getTime() / 1000) - activeTask.TimeLeft - 60));
if (timeLeft < 1) mp.events.call("cutMedicEarnings");
} else {
timeLeft = Math.round(Math.abs(Math.floor(currentDate.getTime() / 1000) - deathTime - 60));
timeLeft = Math.round(Math.abs(Math.floor(currentDate.getTime() / 1000) - activeTask.TimeLeft - 120));
if (timeLeft < 1) mp.events.call("destroyMedicTaskCheckpoint");
}
/*DEBUG TIMER für die Zeit die man noch hat zur Wiederbelebung
if (deadRespawned == false) {
mp.game.graphics.drawText(timeLeft.toString() + "s ", [0.5, 0.88], {
mp.game.graphics.drawText(activeTask.TimeLeft.toString() + "s ", [0.5, 0.88], {
font: 7,
color: [60, 179, 113, 255],
scale: [0.3, 0.3],
@@ -539,7 +547,7 @@ export default function factionInteraction(globalData: IGlobalData) {
});
} else {
{
mp.game.graphics.drawText(timeLeft.toString() + "s", [0.5, 0.88], {
mp.game.graphics.drawText(activeTask.TimeLeft.toString() + "s", [0.5, 0.88], {
font: 7,
color: [255, 203, 145, 255],
scale: [0.3, 0.3],
@@ -547,7 +555,7 @@ export default function factionInteraction(globalData: IGlobalData) {
centre: true
});
}
} */
}
}
});
}