Description
Disables or enables the keyboard and mouse input. Usually used during cutscenes.
Warning
Be careful and responsible with the usage of this command. Once the user input is disabled, the only option left is to restart the game. Make sure you provide scripted mechanics to resolve this, should you need to disable user input for any reason.
Syntax
disableUserInput state
Parameters:
Returns: Nothing
Examples
Example 1
disableUserInput true;
// cutscene
disableUserInput false;
Example 2
Reset user input if a key was pressed:
disableUserInput true; // here e.g W was pressed
sleep 2; // the user releases keys
disableUserInput false; // the game considers W is still pressed as it did not listen to a "KeyUp" event
disableUserInput true;
disableUserInput false; // this resets released keys making the issue invisible
// this workaround does not fix the mouse input that may get stuck on [[disableUserInput]] call
See also
userInputDisabled · enableSimulation · enableSimulationGlobal