ForcePedMotionState
Docslocal retval = ForcePedMotionState(ped, motionStateHash, shouldReset, updateState, forceAIPreCameraUpdate)Description
enum ePedMotionState
{
MOTIONSTATE_NONE = -294553821, // MotionState_None
MOTIONSTATE_IDLE = -1871534317, // MotionState_Idle
MOTIONSTATE_WALK = -668482597, // MotionState_Walk
MOTIONSTATE_RUN = -530524, // MotionState_Run
MOTIONSTATE_SPRINT = -1115154469, // MotionState_Sprint
MOTIONSTATE_CROUCH_IDLE = 1140525470, // MotionState_Crouch_Idle
MOTIONSTATE_CROUCH_WALK = 147004056, // MotionState_Crouch_Walk
MOTIONSTATE_CROUCH_RUN = 898879241, // MotionState_Crouch_Run
MOTIONSTATE_DONOTHING = 247561816, // MotionState_DoNothing
MOTIONSTATE_ANIMATEDVELOCITY = 1427811395, // MotionState_AnimatedVelocity
MOTIONSTATE_INVEHICLE = -1797663347, // MotionState_InVehicle
MOTIONSTATE_AIMING = 1063765679, // MotionState_Aiming
MOTIONSTATE_DIVING_IDLE = 1212730861, // MotionState_Diving_Idle
MOTIONSTATE_DIVING_SWIM = -1855028596, // MotionState_Diving_Swim
MOTIONSTATE_SWIMMING_TREADWATER = -776007225, // MotionState_Swimming_TreadWater
MOTIONSTATE_DEAD = 230360860, // MotionState_Dead
MOTIONSTATE_STEALTH_IDLE = 1110276645, // MotionState_Stealth_Idle
MOTIONSTATE_STEALTH_WALK = 69908130, // MotionState_Stealth_Walk
MOTIONSTATE_STEALTH_RUN = -83133983, // MotionState_Stealth_Run
MOTIONSTATE_PARACHUTING = -1161760501, // MotionState_Parachuting
MOTIONSTATE_ACTIONMODE_IDLE = -633298724, // MotionState_ActionMode_Idle
MOTIONSTATE_ACTIONMODE_WALK = -762290521, // MotionState_ActionMode_Walk
MOTIONSTATE_ACTIONMODE_RUN = 834330132, // MotionState_ActionMode_Run
MOTIONSTATE_JETPACK = 1398696542 // MotionState_Jetpack
}Parameters
| Name | Type | Description |
|---|---|---|
ped | Ped | The ped handle. |
motionStateHash | Hash | The motion state hash. |
shouldReset | BOOL | If the motion state should be set even if the ped is already in the specified motion state. |
updateState | int | Integer but treated as a boolean (only allows 1 or 0). Sets ped reset flags `CPED_RESET_FLAG_ForcePreCameraAiAnimUpdateIfFirstPerson` and `CPED_RESET_FLAG_ForcePostCameraAnimUpdate`. |
forceAIPreCameraUpdate | BOOL | If `updateState` is 1, will set either `CPED_RESET_FLAG_ForcePreCameraAIUpdate` (if true) or `CPED_RESET_FLAG_ForcePostCameraAIUpdate` (if false) ped reset flags. |
Quick Snippet: Get Ped Handleped
pedUse this to get the player ped handle for this native.
-- Get the player's ped handle (client-side)
local ped = PlayerPedId()
print("Ped handle: " .. ped)
-- For a specific player's ped (server-side):
-- local targetPed = GetPlayerPed(source)Ped Models

mp_m_freemode_01
player_zero
ig_agatha
s_m_y_cop_01
s_m_m_gaffer_01
g_m_m_armboss_01
a_c_boar
a_m_m_bevhills_01Returns
BOOLReturns TRUE (1) or FALSE (0).