ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Server functions
  3. setPedAnalogControlState

Function

setPedAnalogControlState

ServerPedsIdentical to MTA:SA

Sets a ped's analog control within 0-1, i.e. how hard it is "pressed" (e.g. 0.5 = half throttle). The value is stored for scripts; in addition any value above 0 presses the regular control of that name and 0 releases it, so for NPCs forwards, backwards and sprint work in the game as with setPedControlState (without graded strength).

Syntax

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

Arguments

pedped
A player or an NPC.
controlstring
Control name, e.g. "accelerate", "forwards", "vehicle_left".
statefloat
Strength 0-1; values outside are clamped. 0 = released.

Returns

true on success.

Example

setPedAnalogControlState(walker, "forwards", 1)

See also