diff --git a/ReallifeGamemode.Client/index.ts b/ReallifeGamemode.Client/index.ts index 40099730..8102c94c 100644 --- a/ReallifeGamemode.Client/index.ts +++ b/ReallifeGamemode.Client/index.ts @@ -40,8 +40,6 @@ mp.game.vehicle.defaultEngineBehaviour = false; require('./Gui/house'); -InputHelper.startDisableTimer(); - import vehicleEntering from './vehiclesync/entering'; vehicleEntering(globalData); diff --git a/ReallifeGamemode.Client/inputhelper/index.ts b/ReallifeGamemode.Client/inputhelper/index.ts index b31bc462..fb1e5f4c 100644 --- a/ReallifeGamemode.Client/inputhelper/index.ts +++ b/ReallifeGamemode.Client/inputhelper/index.ts @@ -9,6 +9,8 @@ export default class InputHelper { static active: boolean = false; + static timerStarted: boolean = false; + constructor(title: string, globalData?: IGlobalData) { this.title = title; this.data = globalData || GlobalData; @@ -27,14 +29,18 @@ export default class InputHelper { this.value = undefined; } - static startDisableTimer(): void { + startDisableTimer(): void { mp.gui.chat.push("RENDER REGISTRIEREN"); mp.events.add("render", () => { + game.ui.sendChatMessage("render in inputhelper"); - mp.game.controls.disableAllControlActions(0); - mp.game.controls.disableAllControlActions(1); - mp.game.controls.disableAllControlActions(2); - mp.game.controls.disableAllControlActions(27); + + if (InputHelper.active) { + mp.game.controls.disableAllControlActions(0); + mp.game.controls.disableAllControlActions(1); + mp.game.controls.disableAllControlActions(2); + mp.game.controls.disableAllControlActions(27); + } }) } @@ -52,6 +58,12 @@ export default class InputHelper { this.created = true; this.browser = mp.browsers.new('package://assets/html/inputhelper/index.html'); InputHelper.active = true; + + if (!InputHelper.timerStarted) { + InputHelper.timerStarted = true; + this.startDisableTimer(); + + } } private finish() {