M MY Multiplayer: Wiki
Side
Kind

setPedAnalogControlState

Client

Presses one of a ped's analog controls only partly, for example to make it walk slowly or steer gently.

bool setPedAnalogControlState(ped thePed, string control, float state)

Parameters

NameTypeDescription
thePedpedThe ped. For any element, the function also applies to the elements below it, and the result is the element's own.
controlstringAn analog control: left, right, forwards, backwards, vehicle_left, vehicle_right, steer_forward, steer_back, accelerate, brake_reverse, special_control_left, special_control_right, special_control_up or special_control_down.
statefloatHow far to press it, from 0 to 1. Values outside are clamped.

Returns

true if the state was applied. false if the control name does not exist, the control is not analog or the element is not a ped.

Pressing a control releases its opposite: forwards clears backwards, left clears right and so on.

Example

local ped = createPed("male01", 2495.0, -1685.0, 13.5)
setPedAnalogControlState(ped, "forwards", 0.4)
setPedControlState(ped, "walk", true)
NoteOnly peds move with it. On a player, the local one included, the function returns true but does nothing; for the local player, use setControlState.

See also