RedM Natives

SET_PED_TO_RAGDOLL_WITH_FALL

Return variable is never used in R's scripts.

Hash0xFA12E286
Runtime nameSetPedToRagdollWithFall
NamespaceCFX
SideServer
NameOfficial
Docs

Signature

void SET_PED_TO_RAGDOLL_WITH_FALL(Ped ped, int minTime, int maxTime, int nFallType, float dirX, float dirY, float dirZ, float fGroundHeight, float grab1X, float grab1Y, float grab1Z, float grab2X, float grab2Y, float grab2Z);

Parameters

NameTypeDescription
pedPed

The ped to ragdoll.

minTimeint—
maxTimeint—
nFallTypeint

The type of fall.

dirXfloat

The x direction of the fall.

dirYfloat

The y direction of the fall.

dirZfloat

The z direction of the fall.

fGroundHeightfloat

The ground height (z).

grab1Xfloat

unused

grab1Yfloat

unused

grab1Zfloat

unused

grab2Xfloat

unused

grab2Yfloat

unused

grab2Zfloat

unused

Returns void

Description

Cfx.re native reference

enum eNMFallType {
TYPE_FROM_HIGH = 0,
TYPE_OVER_WALL = 1,
TYPE_DOWN_STAIRS = 2,
TYPE_DIE_TYPES = 3,
TYPE_DIE_FROM_HIGH = 4,
TYPE_DIE_OVER_WALL = 5,
TYPE_DIE_DOWN_STAIRS = 6
}
Return variable is never used in R*'s scripts.
Not sure what p2 does. It seems like it would be a time judging by it's usage in R*'s scripts, but didn't seem to affect anything in my testings.
x, y, and z are coordinates, most likely to where the ped will fall.
p7 is probably the force of the fall, but untested, so I left the variable name the same.
p8 to p13 are always 0f in R*'s scripts.
(Simplified) Example of the usage of the function from R*'s scripts:
ped::set_ped_to_ragdoll_with_fall(ped, 1500, 2000, 1, -entity::get_entity_forward_vector(ped), 1f, 0f, 0f, 0f, 0f, 0f, 0f);

This is the server-side RPC native equivalent of the client native SET_PED_TO_RAGDOLL_WITH_FALL.

Usage

Lua
SetPedToRagdollWithFall(ped, minTime, maxTime, nFallType, dirX, dirY, dirZ, fGroundHeight, grab1X, grab1Y, grab1Z, grab2X, grab2Y, grab2Z)

-- always works, by hash
Citizen.InvokeNative(0xfa12e286, ped, minTime, maxTime, nFallType, dirX, dirY, dirZ, fGroundHeight, grab1X, grab1Y, grab1Z, grab2X, grab2Y, grab2Z)
JavaScript and C#
JavaScript
SetPedToRagdollWithFall(ped, minTime, maxTime, nFallType, dirX, dirY, dirZ, fGroundHeight, grab1X, grab1Y, grab1Z, grab2X, grab2Y, grab2Z);

// by hash
Citizen.invokeNative('0xfa12e286', ped, minTime, maxTime, nFallType, dirX + 0.0000001, dirY + 0.0000001, dirZ + 0.0000001, fGroundHeight + 0.0000001, grab1X + 0.0000001, grab1Y + 0.0000001, grab1Z + 0.0000001, grab2X + 0.0000001, grab2Y + 0.0000001, grab2Z + 0.0000001);
C#
Function.Call((Hash)0xfa12e286, ped, minTime, maxTime, nFallType, dirX, dirY, dirZ, fGroundHeight, grab1X, grab1Y, grab1Z, grab2X, grab2Y, grab2Z);
  • Float parameters: Lua integers (10, or whole numbers decoded from NUI/JSON) are sent as ints and read as garbage. Write 10.0 or value + 0.0. The generated JS wrappers add 0.0000001 to non-zero floats for the same reason.

Sources

Cfx.re native reference

Something wrong or missing? Contribute a verified note — corrections ship through pull requests.