From 2f1d130c8bc00670d4c36ea140eae4d8808b13e2 Mon Sep 17 00:00:00 2001 From: kookroach Date: Sun, 2 May 2021 23:29:06 +0200 Subject: [PATCH] Fix some Button Stuff and prolly Cuff break --- ReallifeGamemode.Client/Gui/vehiclemenu/main.ts | 16 ++++++++-------- ReallifeGamemode.Client/Player/keys.ts | 4 ++-- ReallifeGamemode.Client/util/animationSync.ts | 11 +++++------ 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/ReallifeGamemode.Client/Gui/vehiclemenu/main.ts b/ReallifeGamemode.Client/Gui/vehiclemenu/main.ts index b967f544..12d0e72d 100644 --- a/ReallifeGamemode.Client/Gui/vehiclemenu/main.ts +++ b/ReallifeGamemode.Client/Gui/vehiclemenu/main.ts @@ -50,7 +50,7 @@ export default function vehicleMenu(globalData: IGlobalData) { }); mp.events.add('ToggleVehicleMenu', () => { - if (menuBrowser !== null) { + if (globalData.InMenu && menuBrowser !== null) { menuBrowser.destroy(); menuBrowser = null; globalData.InMenu = false; @@ -59,14 +59,14 @@ export default function vehicleMenu(globalData: IGlobalData) { mp.game.graphics.stopScreenEffect("FocusIn"); mp.game.graphics.startScreenEffect("FocusOut", 0, false); return; + } else { + mp.game.graphics.stopScreenEffect("FocusOut"); + mp.game.graphics.startScreenEffect("FocusIn", 0, false); + menuBrowser = mp.browsers.new("package://assets/html/vehiclemenu/index.html"); + mp.gui.chat.show(false); + globalData.InMenu = true; + mp.gui.cursor.show(true, true); } - - mp.game.graphics.stopScreenEffect("FocusOut"); - mp.game.graphics.startScreenEffect("FocusIn", 0, false); - menuBrowser = mp.browsers.new("package://assets/html/vehiclemenu/index.html"); - mp.gui.chat.show(false); - globalData.InMenu = true; - mp.gui.cursor.show(true, true); }); mp.events.add('doAction', (action) => { diff --git a/ReallifeGamemode.Client/Player/keys.ts b/ReallifeGamemode.Client/Player/keys.ts index aa3015b5..c3b7fa1d 100644 --- a/ReallifeGamemode.Client/Player/keys.ts +++ b/ReallifeGamemode.Client/Player/keys.ts @@ -123,8 +123,8 @@ export default function keys(globalData: IGlobalData) { }); //Z // Fahrzeug Verwaltung - MenĂ¼ - mp.keys.bind.bind(0x5A, false, function () { - if (!globalData.InChat && !globalData.InMenu && !globalData.InTuning) { + KeyBinder.bind("z", () => { + if (!globalData.InChat && !globalData.InTuning) { mp.events.callRemote("keyPress:Z"); } }); diff --git a/ReallifeGamemode.Client/util/animationSync.ts b/ReallifeGamemode.Client/util/animationSync.ts index b56765a3..f786b64a 100644 --- a/ReallifeGamemode.Client/util/animationSync.ts +++ b/ReallifeGamemode.Client/util/animationSync.ts @@ -87,7 +87,7 @@ export default function animationSync() { mp.events.addDataHandler("AnimationData", (entity, string) => { entity.clearTasksImmediately(); if (animationBreakTimer) { - clearInterval(animationBreakTimer); + clearTimeout(animationBreakTimer); animationBreakTimer = null; } if (string == null) { @@ -109,13 +109,12 @@ export default function animationSync() { if (mp.players.local == entity) { if (!endless) { - animationBreakTimer = setInterval(() => breakAnimation(name), 120000); + animationBreakTimer = setTimeout(() => breakAnimation(name), 120000); } if (!loop) { - let a = setInterval(function () { - clearInterval(a); - mp.game.wait(500); + let a = setTimeout(function () { + clearTimeout(a); mp.events.callRemote("CLIENT:ClearAnimationData", true); }, duration); } @@ -126,7 +125,7 @@ export default function animationSync() { let { animName, msg } = animationBreakMessage.find(c => c.animName == name) if (msg) - mp.events.call("renderTextOnScreen", msg); + mp.events.call("BN_Show", msg); clearInterval(animationBreakTimer); animationBreakTimer = null;