From 865c78833b0f253e0ac061f3d2a1891a0442468c Mon Sep 17 00:00:00 2001 From: VegaZ Date: Mon, 1 Mar 2021 20:01:02 +0100 Subject: [PATCH] *Disabled Game-Input while in InputField --- ReallifeGamemode.Client/inputhelper/index.ts | 23 ++++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/ReallifeGamemode.Client/inputhelper/index.ts b/ReallifeGamemode.Client/inputhelper/index.ts index b0fc9880..23107c82 100644 --- a/ReallifeGamemode.Client/inputhelper/index.ts +++ b/ReallifeGamemode.Client/inputhelper/index.ts @@ -1,4 +1,6 @@ import game, { GlobalData } from ".."; +import { INSPECT_MAX_BYTES } from "buffer"; +let disableInputTimer; export default class InputHelper { private title: string; @@ -26,20 +28,24 @@ export default class InputHelper { mp.events.add('closeinputhelper', this.finish); + mp.events.add("render", () => { + + }); } show() { - if (this.created) return; - + if (this.created) return; this.data.InMenu = true; this.data.InInput = true; this.created = true; this.browser = mp.browsers.new('package://assets/html/inputhelper/index.html'); mp.gui.cursor.show(true, true); + disableInputTimer = setInterval(disableInput, 1); } private finish() { if (this.browser) { + clearInterval(disableInputTimer); mp.events.remove('cef_inputhelper_sendvalue'); mp.events.remove('cef_request_title'); this.browser.destroy(); @@ -48,6 +54,7 @@ export default class InputHelper { this.created = false; this.browser = null; mp.gui.cursor.show(false, false); + } } @@ -68,14 +75,16 @@ export default class InputHelper { resolve(this.value); }); } - async getValue(callback: Function) { var getVal = await this.valueGetter(); callback(getVal); + } +} + +function disableInput() { + for (var x = 0; x < 32; x++) { + mp.game.controls.disableAllControlActions(x); } } -exports = InputHelper; - - - +exports = InputHelper; \ No newline at end of file