FiveM Docs / Native Reference
API Set:
  • all
  • server
  • client
Language:
  • raw
  • lua
  • c#
  • js
Namespace: ENTITYAPI set: clientGame: gta5editImprove

APPLY_FORCE_TO_ENTITY

0xC5F68BE9613E2D18
0xC1C0855A
// ApplyForceToEntity
void APPLY_FORCE_TO_ENTITY(Entity entity, int forceType, float x, float y, float z, float offX, float offY, float offZ, int nComponent, BOOL bLocalForce, BOOL bLocalOffset, BOOL bScaleByMass, BOOL bPlayAudio, BOOL bScaleByTimeWarp);
Parameters:
  • entity:

    The entity handle

  • forceType:

    The force type

  • x:

    The x component of the force to apply

  • y:

    The y component of the force to apply

  • z:

    The z component of the force to apply

  • offX:

    Offset from center of entity (X)

  • offY:

    Offset from center of entity (Y)

  • offZ:

    Offset from center of entity (Z)

  • nComponent:

    Component of the entity to apply the force too. Only matters for breakable or articulated (ragdoll) physics. 0 means the root or parent component

  • bLocalForce:

    Specifies whether the force vector passed in is in local or world coordinates. true means the force will get automatically transformed into world space before being applied

  • bLocalOffset:

    Specifies whether the offset passed in is in local or world coordinates

  • bScaleByMass:

    Specifies whether to scale the force by mass

  • bPlayAudio:

    Specifies whether to play audio events related to the force being applied. The audio will depend on the entity type. Currently vehicles are the only entity types supported, and will play a suspension squeal depending on the magnitude of the force

  • bScaleByTimeWarp:

    Specifies whether to scale the force by time warp. Default is true

enum eApplyForceTypes {
    APPLY_TYPE_FORCE = 0,
    APPLY_TYPE_IMPULSE = 1,
    APPLY_TYPE_EXTERNAL_FORCE = 2,
    APPLY_TYPE_EXTERNAL_IMPULSE = 3,
    APPLY_TYPE_TORQUE = 4,
    APPLY_TYPE_ANGULAR_IMPULSE = 5
}

Examples:

  • Lua
local entity = PlayerPedId()
local forceType = 2
 -- sends the entity straight up into the sky:
local direction = vector3(0.0, 0.0, 15.0)
local offset = vector3(0.0, 0.0, 0.0)
local component = 0
local localForce = false
local localOffset = true
local scaleByMass = true
local playAudio = false
local scaleByTimeWarp = true

ApplyForceToEntity(
    entity,
    forceType,
    direction,
    offset,
    boneIndex,
    localForce,
    localOffset,
    scaleByMass,
    playAudio,
    scaleByTimeWarp
)
Privacy
•
Cookie Policy
•
Cookie Settings
0x5C41E6BABC9E2112(Any p0)
0x5C48A1D6E3B33179(Cam cam)
0x5D96CFB59DA076A0(Vehicle vehicle, int p1, float p2)
0x62374889A4D59F72()
0x62ECFCFDEE7885D6()
0x705A276EBFF3133D()
0x7295C203DD659DFE()
0x91EF6EE6419E5B97(BOOL p0)
0x9DFE13ECDC1EC196(BOOL p0, BOOL p1)
0x9F97DA93681F87EA()
0xA2767257A320FC82(Any p0, BOOL p1)
0xA7092AFE81944852()
0xAABD62873FFB1A33(Any p0, Any p1)
0xB1381B97F70C7B30()
0xBF72910D0F26F025()
0xC8391C309684595A()
0xC8B5C4A79CC18B94(Cam cam)
0xCCD078C2665D2973(BOOL p0)
0xCED08CBE8EBB97C7(float p0, float p1)
0xDB90C6CCA48940F1(BOOL p0)
0xDD79DF9F4D26E1C9()
0xE111A7C0D200CBC5(Any p0, float p1)
0xF55E4046F6F831DC(Any p0, float p1)
0xFD3151CD37EA2245(Entity entity)
Namespace: CLOCK
ADD_TO_CLOCK_TIME(int hours, int minutes, int seconds)
ADVANCE_CLOCK_TIME_TO(int hour, int minute, int second)
GET_CLOCK_DAY_OF_MONTH()
GET_CLOCK_DAY_OF_WEEK()
GET_CLOCK_HOURS()
GET_CLOCK_MINUTES()
GET_CLOCK_MONTH()
GET_CLOCK_SECONDS()
GET_CLOCK_YEAR()
GET_LOCAL_TIME(int* year, int* month, int* day, int* hour, int* minute, int* second)