Rework deathdate in ReviveTasks

This commit is contained in:
VegaZ
2021-02-13 17:26:09 +01:00
parent 02f0943e11
commit 81fc9f6c6e
3 changed files with 38 additions and 8 deletions

View File

@@ -13,6 +13,7 @@ export default function factionInteraction(globalData: IGlobalData) {
var screenRes = mp.game.graphics.getScreenResolution(0, 0);
var player = mp.players.local;
var tasks;
var deathSeconds;
var initTasks;
var newTasks;
var sorting = 0;
@@ -37,10 +38,12 @@ export default function factionInteraction(globalData: IGlobalData) {
var factionInteractionMenu;
var healTaskMenuMedic;
var reviveTaskMenuMedic;
var insDate;
/*mp.events.add("updateFactionBlips", (type, taskList) => {
});
});*/
mp.events.add("showFactionInteractionLSPD", (userFactionId, isDuty, userFactionName, isFactionLeader) => {
//LSPD
let ticketTaskMenuLSPD;
@@ -284,9 +287,10 @@ export default function factionInteraction(globalData: IGlobalData) {
});
mp.events.add("showMedicTasks", (type, taskList) => {
mp.events.add("showMedicTasks", (type, taskList, deathTimes) => {
tasks = JSON.parse(taskList);
deathSeconds = JSON.parse(deathTimes);
if (sorting === 0) {
initTasks = tasks;
}
@@ -332,7 +336,7 @@ export default function factionInteraction(globalData: IGlobalData) {
dimension: 0
});
reviveTaskMenuMedic.Close();
deathTime = tasks[index].Time;
deathTime = deathSeconds[index];
mp.gui.chat.activate(true);
globalData.InMenu = false;
ambulanceImagePos = 0.325
@@ -523,10 +527,10 @@ export default function factionInteraction(globalData: IGlobalData) {
var currentDate = new Date();
if (deadRespawned == false) {
timeLeft = Math.round(Math.abs(deathTime.getTime() - 30 - Math.floor(currentDate.getTime() / 1000)));
timeLeft = Math.round(Math.abs(deathTime - 30 - Math.floor(currentDate.getTime() / 1000)));
if (timeLeft < 1) mp.events.call("cutMedicEarnings");
} else {
timeLeft = Math.round(Math.abs(deathTime.getTime() - 60 - Math.floor(currentDate.getTime() / 1000)));
timeLeft = Math.round(Math.abs(deathTime - 60 - Math.floor(currentDate.getTime() / 1000)));
if (timeLeft < 1) mp.events.call("destroyMedicTaskCheckpoint");
}