Fix Medic 4

This commit is contained in:
VegaZ
2021-04-04 16:08:49 +02:00
parent c51fbd3246
commit a64adccfb9

View File

@@ -25,7 +25,7 @@ export default function factionInteraction(globalData: IGlobalData) {
var rangeLeft;
var sortText;
var deadRespawned = false;
var timeLeft = 0;
var timeLeft = null;
var deathTime;
var ticketName: string;
@@ -475,7 +475,7 @@ export default function factionInteraction(globalData: IGlobalData) {
activeCheckpoint.destroy();
activeCheckpoint = null;
activeTask = null;
timeLeft = 0;
timeLeft = null;
mp.events.callRemote("MedicTaskTimeout");
});
@@ -486,18 +486,19 @@ export default function factionInteraction(globalData: IGlobalData) {
mp.events.callRemote("PayCutMedicEarnings");
activeTask = null;
deadRespawned = false;
timeLeft = 0;
timeLeft = null;
} else if (activeTask.Type == 1){
activeCheckpoint.destroy();
activeCheckpoint = null;
mp.events.callRemote("delHealTaskAsMedic", activeTask.Victim);
activeTask = null;
timeLeft = null;
}
});
mp.events.add('setTaskTimeLeft', (taskTimeLeft) => {
if (activeTask) {
activeTask.TimeLeft = taskTimeLeft;
timeLeft = taskTimeLeft;
}
});
@@ -527,14 +528,14 @@ export default function factionInteraction(globalData: IGlobalData) {
if (deadRespawned == false) {
//timeLeft = Math.round(Math.abs(Math.floor(currentDate.getTime() / 1000) - activeTask.TimeLeft - 60));
if (activeTask.TimeLeft < 60) mp.events.call("cutMedicEarnings");
if (timeLeft < 60) mp.events.call("cutMedicEarnings");
} else {
timeLeft = Math.round(Math.abs(Math.floor(currentDate.getTime() / 1000) - activeTask.TimeLeft - 120));
if (activeTask.TimeLeft < 1) mp.events.call("destroyMedicTaskCheckpoint");
//timeLeft = Math.round(Math.abs(Math.floor(currentDate.getTime() / 1000) - activeTask.TimeLeft - 120));
if (timeLeft < 1) mp.events.call("destroyMedicTaskCheckpoint");
}
if (deadRespawned == false) {
mp.game.graphics.drawText(activeTask.TimeLeft.toString() + "s ", [0.5, 0.88], {
mp.game.graphics.drawText(timeLeft.toString() + "s ", [0.5, 0.88], {
font: 7,
color: [60, 179, 113, 255],
scale: [0.3, 0.3],