Fix some Button Stuff and prolly Cuff break

This commit is contained in:
2021-05-02 23:29:06 +02:00
parent 2fe03af890
commit 2f1d130c8b
3 changed files with 15 additions and 16 deletions

View File

@@ -50,7 +50,7 @@ export default function vehicleMenu(globalData: IGlobalData) {
}); });
mp.events.add('ToggleVehicleMenu', () => { mp.events.add('ToggleVehicleMenu', () => {
if (menuBrowser !== null) { if (globalData.InMenu && menuBrowser !== null) {
menuBrowser.destroy(); menuBrowser.destroy();
menuBrowser = null; menuBrowser = null;
globalData.InMenu = false; globalData.InMenu = false;
@@ -59,14 +59,14 @@ export default function vehicleMenu(globalData: IGlobalData) {
mp.game.graphics.stopScreenEffect("FocusIn"); mp.game.graphics.stopScreenEffect("FocusIn");
mp.game.graphics.startScreenEffect("FocusOut", 0, false); mp.game.graphics.startScreenEffect("FocusOut", 0, false);
return; return;
} } else {
mp.game.graphics.stopScreenEffect("FocusOut"); mp.game.graphics.stopScreenEffect("FocusOut");
mp.game.graphics.startScreenEffect("FocusIn", 0, false); mp.game.graphics.startScreenEffect("FocusIn", 0, false);
menuBrowser = mp.browsers.new("package://assets/html/vehiclemenu/index.html"); menuBrowser = mp.browsers.new("package://assets/html/vehiclemenu/index.html");
mp.gui.chat.show(false); mp.gui.chat.show(false);
globalData.InMenu = true; globalData.InMenu = true;
mp.gui.cursor.show(true, true); mp.gui.cursor.show(true, true);
}
}); });
mp.events.add('doAction', (action) => { mp.events.add('doAction', (action) => {

View File

@@ -123,8 +123,8 @@ export default function keys(globalData: IGlobalData) {
}); });
//Z // Fahrzeug Verwaltung - Menü //Z // Fahrzeug Verwaltung - Menü
mp.keys.bind.bind(0x5A, false, function () { KeyBinder.bind("z", () => {
if (!globalData.InChat && !globalData.InMenu && !globalData.InTuning) { if (!globalData.InChat && !globalData.InTuning) {
mp.events.callRemote("keyPress:Z"); mp.events.callRemote("keyPress:Z");
} }
}); });

View File

@@ -87,7 +87,7 @@ export default function animationSync() {
mp.events.addDataHandler("AnimationData", (entity, string) => { mp.events.addDataHandler("AnimationData", (entity, string) => {
entity.clearTasksImmediately(); entity.clearTasksImmediately();
if (animationBreakTimer) { if (animationBreakTimer) {
clearInterval(animationBreakTimer); clearTimeout(animationBreakTimer);
animationBreakTimer = null; animationBreakTimer = null;
} }
if (string == null) { if (string == null) {
@@ -109,13 +109,12 @@ export default function animationSync() {
if (mp.players.local == entity) { if (mp.players.local == entity) {
if (!endless) { if (!endless) {
animationBreakTimer = setInterval(() => breakAnimation(name), 120000); animationBreakTimer = setTimeout(() => breakAnimation(name), 120000);
} }
if (!loop) { if (!loop) {
let a = setInterval(function () { let a = setTimeout(function () {
clearInterval(a); clearTimeout(a);
mp.game.wait(500);
mp.events.callRemote("CLIENT:ClearAnimationData", true); mp.events.callRemote("CLIENT:ClearAnimationData", true);
}, duration); }, duration);
} }
@@ -126,7 +125,7 @@ export default function animationSync() {
let { animName, msg } = animationBreakMessage.find(c => c.animName == name) let { animName, msg } = animationBreakMessage.find(c => c.animName == name)
if (msg) if (msg)
mp.events.call("renderTextOnScreen", msg); mp.events.call("BN_Show", msg);
clearInterval(animationBreakTimer); clearInterval(animationBreakTimer);
animationBreakTimer = null; animationBreakTimer = null;