Skip to content

setAnalogControlState

Shared

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This sets the analog control state of a control for the local player. To change the analog controls for a ped, please use setPedAnalogControlState.

Syntax

bool setAnalogControlState ( ​string control, ​float state, [ ​bool forceOverrideNextFrame = false ] )
Required arguments
  • control: The control that you want to set the state of. See control names for a list of possible controls.
  • state: A float between 0 and 1 indicating the amount the control is pressed. If no value is provided, the analog control is removed.
Optional arguments

Note: when using optional arguments, you might need to supply all arguments before the one you wish to use.

  • forceOverrideNextFrame (default: false): MISSING_PARAM_DESC

Returns

Returns true if the control state was successfully set, false otherwise.

  • bool: value

Code Examples

shared

This creates an/forwardscommand, which toggles yourforwardscontrol state between 0 and 1.

addCommandHandler( "forwards",
function( )
if ( getAnalogControlState( "forwards" ) == 0 ) then
setAnalogControlState( "forwards", 1 )
else
setAnalogControlState( "forwards", 0 )
end
end
)