SetPedControlState

From Multi Theft Auto: Wiki
Revision as of 10:45, 19 June 2017 by Einheit-101 (talk | contribs) (Changed the fact that it now works with the local player just fine after r11427)
Jump to navigation Jump to search

This function makes a ped press or release a certain control. It doesn't work with the local player, so use setControlState instead.


  • Works with local player aswell.

Syntax

bool setPedControlState ( ped thePed, string control, bool state )

Required Arguments

  • thePed: the ped you want to press or release a control.
  • control: the name of the control of which to change the state. See control names for a list of valid names.
  • state: the new control state. true means pressed, false is released.

Returns

Returns true if successful, false if otherwise.

Example

Click to collapse [-]
Client
function newPed()
  local x, y, z = getElementPosition(localPlayer)
  local myPed = createPed(0, x + 1, y, z)
  if myPed then 
    setPedControlState(myPed,"forwards", true)
  end 
end
addCommandHandler("ped",newPed)

See Also