bigmap jetzt togglebar

This commit is contained in:
Luke
2021-05-31 17:12:52 +02:00
parent 7a617d9c69
commit 883a067fc1

View File

@@ -1,35 +1,17 @@
import { GlobalData } from ".."; import { GlobalData } from "..";
export default function bigmap() { export default function bigmap() {
var bigmap = { enabled: false, timer: null }; var bigMapActive = false;
mp.game.ui.setRadarZoom(0.0); mp.game.ui.setRadarZoom(0.0);
mp.game.ui.setRadarBigmapEnabled(false, false); mp.game.ui.setRadarBigmapEnabled(false, false);
mp.events.add("render", () => { mp.events.add("render", () => {
mp.game.controls.disableControlAction(0, 48, true); mp.game.controls.disableControlAction(0, 48, true);
if (mp.game.controls.isDisabledControlJustPressed(0, 48) && !GlobalData.InChat) { if (mp.game.controls.isDisabledControlJustPressed(0, 48) && !GlobalData.InChat) {
if (bigmap.timer != null) { bigMapActive = !bigMapActive;
clearTimeout(bigmap.timer); mp.game.ui.setRadarBigmapEnabled(bigMapActive, false);
bigmap.timer = null;
}
if (!bigmap.enabled) {
mp.game.ui.setRadarBigmapEnabled(true, false);
mp.game.ui.setRadarZoom(1.0);
bigmap.enabled = true;
bigmap.timer = setTimeout(() => {
mp.game.ui.setRadarBigmapEnabled(false, false);
mp.game.ui.setRadarZoom(0.0);
bigmap.enabled = false;
bigmap.timer = null;
}, 7500);
} else {
mp.game.ui.setRadarBigmapEnabled(false, false);
mp.game.ui.setRadarZoom(0.0);
bigmap.enabled = false;
}
} }
}); });
} }