GetPedMoveState: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(Undo revision 27966 by Jaysds1 (talk) Example contains various errors)
Line 17: Line 17:


==Example==
==Example==
This example checks every 22 seconds to see if the player is walking
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function spawner()
-- TODO
  setTimer(moveState,220000,1)
end
addEventHandler("onClientPlayerSpawn",getRootElement(),spawner)
 
function moveState()
  if (getPedMoveState(getLocalPlayer()) == "stand" or "crouch") then
      outputChatBox("KEEP MOVING YOU!",255,0,0)
  elseif (getPedMoveState(getLocalPlayer()) == "walk" or "powerwalk" or "jog" or "sprint") then
      outputChatBox("Your still moving, take a brake.",0,100,0)
  end
end
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{Ped functions}}
{{Ped functions}}

Revision as of 11:46, 17 November 2011

This function returns the current move state for the specified ped.

Syntax

string getPedMoveState ( ped thePed )

Required Arguments

  • thePed: The ped whose move state you want to know

Returns

Returns a string indicating the ped's move state, or false if the ped is not streamed in, the movement type is unknown, the ped is in a vehicle or the ped is invalid.

  • stand: The ped is standing still.
  • walk: The ped is walking.
  • powerwalk: The ped is walking quickly.
  • jog: The ped is jogging.
  • sprint: The ped is sprinting.
  • crouch: The ped is crouching still.
  • crawl: The ped is crawling (moving and ducked).
  • jump: The ped is jumping into the air.
  • fall: The ped is falling to the ground.
  • climb: The ped is climbing onto an object.

Example

-- TODO

See Also