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