setAnalogControlState
Client-side
Server-side
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
- bool: value
Returns true if the control state was successfully set, false otherwise.
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)See Also
Input Functions
- addCommandHandler
- bindKey
- executeCommandHandler
- getAnalogControlState
- getBoundKeys
- getCommandHandlers
- getCommandsBoundToKey
- getFunctionsBoundToKey
- getKeyBoundToCommand
- getKeyBoundToFunction
- getKeyState
- isCapsLockEnabled
- isControlEnabled
- isKeyBound
- removeCommandHandler
- setAnalogControlState
- toggleAllControls
- toggleControl
- unbindKey
Input Events
- onClientCharacter
- onClientClick
- onClientCursorMove
- onClientDoubleClick
- onClientGUIAccepted
- onClientGUIBlur
- onClientGUIChanged
- onClientGUIClick
- onClientGUIComboBoxAccepted
- onClientGUIDoubleClick
- onClientGUIFocus
- onClientGUIMouseDown
- onClientGUIMouseUp
- onClientGUIMove
- onClientGUIScroll
- onClientGUISize
- onClientGUITabSwitched
- onClientKey
- onClientMouseEnter
- onClientMouseLeave
- onClientMouseMove
- onClientMouseWheel
- onClientPaste