Medic Fix die 10241581259
This commit is contained in:
@@ -389,73 +389,13 @@ export default function factionInteraction(globalData: IGlobalData) {
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
mp.events.add("sortFactionTasks", (sortByKey) => {
|
||||
if (firstSorting) {
|
||||
sortText = "Nach Uhrzeit";
|
||||
firstSorting = false;
|
||||
//mp.gui.chat.push("Init Sort");
|
||||
return;
|
||||
} else {
|
||||
if (sortByKey) {
|
||||
if (sorting < 1) {
|
||||
sorting++;
|
||||
} else {
|
||||
sorting = 0;
|
||||
}
|
||||
|
||||
switch (sorting) {
|
||||
case 0: //Standartsortierung
|
||||
|
||||
reviveTaskMenuMedic.Close();
|
||||
factionInteractionMenu.Close();
|
||||
sortText = "Nach Uhrzeit";
|
||||
mp.events.call("showMedicTasks", 0, JSON.stringify(initTasks));
|
||||
break;
|
||||
|
||||
case 1: //Sortierung nach Metern (aufsteigend)
|
||||
for (var d = 0; d < tasks.length; d++) {
|
||||
for (var e = 0; e < tasks.length - 1; e++) {
|
||||
if (getDistance1(e) > getDistance2(e + 1)) {
|
||||
var tempTask = tasks[e];
|
||||
tasks[e] = tasks[e + 1];
|
||||
tasks[e + 1] = tempTask;
|
||||
mp.gui.chat.push("SWITCH");
|
||||
}
|
||||
}
|
||||
}
|
||||
reviveTaskMenuMedic.Close();
|
||||
factionInteractionMenu.Close();
|
||||
sortText = "Entfernung aufsteigend";
|
||||
mp.events.call("showMedicTasks", 0, JSON.stringify(tasks));
|
||||
break;
|
||||
|
||||
//case 2: //Sortierung nach Metern (absteigend)
|
||||
// mp.gui.chat.push("Sorting 2");
|
||||
// sortText = "Entfernung absteigend";
|
||||
// break;
|
||||
//case 3: //Sortierung nach Zeit (aufsteigend)
|
||||
// mp.gui.chat.push("Sorting 3");
|
||||
// sortText = "Restzeit aufsteigend";
|
||||
// break;
|
||||
//case 4: //Sortierung nach Zeit (absteigend)
|
||||
// mp.gui.chat.push("Sorting 4");
|
||||
// sortText = "Restzeit absteigend";
|
||||
// break;
|
||||
}
|
||||
}
|
||||
mp.events.add('playerEnterCheckpoint', (activeCheckpoint) => {
|
||||
if (activeTask.Type == 1) {
|
||||
activeCheckpoint.destroy();
|
||||
activeCheckpoint = null;
|
||||
activeTask = null;
|
||||
timeLeft = null;
|
||||
}
|
||||
});*/
|
||||
|
||||
function getDistance1(index) {
|
||||
return mp.game.gameplay.getDistanceBetweenCoords(player.position.x, player.position.y, player.position.z, newTasks[index].Position.x, newTasks[index].Position.y, newTasks[index].Position.z, true).toFixed(2);
|
||||
}
|
||||
function getDistance2(index) {
|
||||
return mp.game.gameplay.getDistanceBetweenCoords(player.position.x, player.position.y, player.position.z, newTasks[index].Position.x, newTasks[index].Position.y, newTasks[index].Position.z, true).toFixed(2);
|
||||
}
|
||||
|
||||
mp.events.add("cutMedicEarnings", () => {
|
||||
deadRespawned = true;
|
||||
});
|
||||
|
||||
mp.events.add("destroyMedicTaskCheckpoint", () => {
|
||||
@@ -464,24 +404,6 @@ export default function factionInteraction(globalData: IGlobalData) {
|
||||
activeCheckpoint = null;
|
||||
activeTask = null;
|
||||
timeLeft = null;
|
||||
mp.events.callRemote("MedicTaskTimeout");
|
||||
}
|
||||
});
|
||||
|
||||
mp.events.add('playerEnterCheckpoint', (activeCheckpoint) => {
|
||||
if (deadRespawned == true) {
|
||||
activeCheckpoint.destroy();
|
||||
activeCheckpoint = null;
|
||||
mp.events.callRemote("PayCutMedicEarnings");
|
||||
activeTask = null;
|
||||
deadRespawned = false;
|
||||
timeLeft = null;
|
||||
} else if (activeTask.Type == 1) {
|
||||
activeCheckpoint.destroy();
|
||||
activeCheckpoint = null;
|
||||
mp.events.callRemote("delHealTaskAsMedic", activeTask.Victim);
|
||||
activeTask = null;
|
||||
timeLeft = null;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -491,7 +413,7 @@ export default function factionInteraction(globalData: IGlobalData) {
|
||||
}
|
||||
});
|
||||
|
||||
mp.events.add('render', () => {
|
||||
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);
|
||||
if (rangeLeft > 1.9) {
|
||||
@@ -513,18 +435,10 @@ export default function factionInteraction(globalData: IGlobalData) {
|
||||
}
|
||||
}
|
||||
|
||||
var currentDate = new Date();
|
||||
|
||||
if (timeLeft != null) {
|
||||
if (deadRespawned == false) {
|
||||
//timeLeft = Math.round(Math.abs(Math.floor(currentDate.getTime() / 1000) - activeTask.TimeLeft - 60));
|
||||
if (timeLeft < 120) mp.events.call("cutMedicEarnings");
|
||||
} else {
|
||||
//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(timeLeft + "s", [0.5, 0.85], {
|
||||
font: 7,
|
||||
color: [60, 179, 113, 255],
|
||||
@@ -545,5 +459,9 @@ export default function factionInteraction(globalData: IGlobalData) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mp.events.add('render', () => {
|
||||
renderMedicGui();
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user