The Lab
VEHICLE native

GET_CLOSEST_VEHICLE

returns Vehicle6 paramsbuild 1207

Returns the closest vehicle within radius of the given coordinates, optionally filtered by modelHash and flags.

Signature

C
Vehicle GET_CLOSEST_VEHICLE(float x, float y, float z, float radius, Hash modelHash, int flags); // 0x52F45D033645181B b1207

Parameters

#NameType
1xfloat
2yfloat
3zfloat
4radiusfloat
5modelHashHash
6flagsint

Facts

Facts about GET_CLOSEST_VEHICLE
Name
GET_CLOSEST_VEHICLE
Hash
0x52F45D033645181B
Namespace
Returns
Vehicle
Game build
1207

Examples

Calls by hash work in every RedM runtime. Replace the placeholder arguments with your own values.

Lua
local vehicle = Citizen.InvokeNative(0x52F45D033645181B, -- GET_CLOSEST_VEHICLE
  0.0, -- float x
  0.0, -- float y
  0.0, -- float z
  0.0, -- float radius
  GetHashKey("a_c_horse_arabian_white"), -- Hash modelHash
  0, -- int flags
  Citizen.ResultAsInteger()
)
print(vehicle)
JavaScript
// Whole JS numbers are sent as integers: pass floats like 1.5 (or n + 0.0000001), never 1.
const vehicle = Citizen.invokeNative("0x52F45D033645181B", // GET_CLOSEST_VEHICLE
  0.0, // float x
  0.0, // float y
  0.0, // float z
  0.0, // float radius
  GetHashKey("a_c_horse_arabian_white"), // Hash modelHash
  0, // int flags
  Citizen.resultAsInteger()
);
console.log(vehicle)
C#
int vehicle = Function.Call<int>((Hash)0x52F45D033645181B, // GET_CLOSEST_VEHICLE
  0.0f, // float x
  0.0f, // float y
  0.0f, // float z
  0.0f, // float radius
  (uint)API.GetHashKey("a_c_horse_arabian_white"), // Hash modelHash
  0 // int flags
);
All VEHICLE natives

Facts compiled from community research (alloc8or/rdr3-nativedb-data, femga/rdr3_discoveries); descriptions and examples by The Lab.