RedM Natives

GET_ENTITY_SPEED

Gets the current speed of the entity in meters per second.

Hash0x9E1E4798
Runtime nameGetEntitySpeed
NamespaceCFX
SideServer
NameOfficial
Docs

Signature

float GET_ENTITY_SPEED(Entity entity);

Parameters

NameTypeDescription
entityEntity

The entity to get the speed of

Returns float — The speed of the entity in meters per second

Description

Cfx.re native reference

Gets the current speed of the entity in meters per second.

To convert to MPH: speed * 2.236936
To convert to KPH: speed * 3.6

Usage

Lua
local retval = GetEntitySpeed(entity)

-- always works, by hash
local retval = Citizen.InvokeNative(0x9e1e4798, entity, Citizen.ResultAsFloat())
JavaScript and C#
JavaScript
const retval = GetEntitySpeed(entity);

// by hash
const retval = Citizen.invokeNative('0x9e1e4798', entity, Citizen.returnResultAnyway(), Citizen.resultAsFloat());
C#
float retval = Function.Call<float>((Hash)0x9e1e4798, entity);

Sources

Cfx.re native reference

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