setPedAnalogControlState | Multi Theft Auto: Wiki Skip to content

setPedAnalogControlState

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.


Sets an analog state of a specified ped's control, as if they pressed or released it.

Syntax

bool setPedAnalogControlState ( ped thePed, string control, float state )
Required Arguments
  • thePed: The ped you wish to set the control state of.
  • 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.

Returns

  • bool: value

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

Code Examples

shared

This example uses setPedAnalogControlState to very slowly accelerate a ped-controlled NRG-500.

function createAnalogControlTest( )
local playerPosition = Vector3( getElementPosition( localPlayer ) )
local theVehicle = createVehicle( 522, playerPosition )
local thePed = createPed( 0, playerPosition )
warpPedIntoVehicle( thePed, theVehicle )
setPedAnalogControlState( thePed, "accelerate", 0.05 )
setPedAnalogControlState( thePed, "vehicle_left", 1 )
end
addCommandHandler( "analogcontroltest", createAnalogControlTest )

See Also