Controls::disableControlAction: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
 
(5 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{ClientsideJsFunction}}
Disable a control so it cannot be used.
== Syntax ==
<pre>
mp.game.controls.disableControlAction(inputGroup, control, disable);
</pre>


<syntaxhighlight lang="javascript">mp.game.controls.disableControlAction(inputGroup, control, disable);</syntaxhighlight>
=== Required Arguments ===
=== Required Arguments ===
*'''inputGroup:''' int
*'''inputGroup:''' {{RageType|Int}} ([[InputGroup|Input Groups]])
*'''control:''' int
*'''control:''' {{RageType|Int}} ([[Controls|Game Controls]])
*'''disable:''' Boolean
*'''disable:''' {{RageType|Boolean}}
 
===Return value===
===Return value===
*'''Undefined'''
*'''Boolean'''


*[[Controls|Game Controls]]
==Example==


==Example==
{{ClientsideCode|
<div class="header" style="background-color: #AE4040; color: #FFFFFF; border: 2px solid #AE4040;">
<pre>
<div style="margin: 10px 10px 10px 10px;"><b>Client-Side</b></div>
// This will disable using the character wheel
<syntaxhighlight lang="javascript">
mp.events.add('render', () => {
mp.events.add('render', () => {
     mp.game.controls.disableControlAction(2, 19, true);
     mp.game.controls.disableControlAction(2, 19, true);
});


// Disable vehicle weapon on RMB.
mp.events.add('render', () => {
    mp.game.controls.disableControlAction(32, 68, true); // Use inputGroup 32 in case you are not sure, it seems to have the whole collection of control actions.
    mp.game.controls.disableControlAction(32, 70, true);
});
});
</syntaxhighlight>
</pre>
</div>
}}


==See also==
==See also==
{{Controls_s_function_c}
{{Controls_functions_c}}
*[[Controls|Game Controls]]
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]

Latest revision as of 10:55, 14 May 2024

Client-Side
Function

 JavaScript



Disable a control so it cannot be used.

Syntax

mp.game.controls.disableControlAction(inputGroup, control, disable);

Required Arguments

Return value

  • Boolean

Example

Client-Side
// This will disable using the character wheel
mp.events.add('render', () => {
    mp.game.controls.disableControlAction(2, 19, true);
});

// Disable vehicle weapon on RMB. 
mp.events.add('render', () => {
    mp.game.controls.disableControlAction(32, 68, true); // Use inputGroup 32 in case you are not sure, it seems to have the whole collection of control actions. 
    mp.game.controls.disableControlAction(32, 70, true);
});

See also