GET_CLOSEST_VEHICLE
Returns the closest vehicle within radius of the given coordinates, optionally filtered by modelHash and flags.
Signature
Vehicle GET_CLOSEST_VEHICLE(float x, float y, float z, float radius, Hash modelHash, int flags); // 0x52F45D033645181B b1207Parameters
| # | Name | Type |
|---|---|---|
| 1 | x | float |
| 2 | y | float |
| 3 | z | float |
| 4 | radius | float |
| 5 | modelHash | Hash |
| 6 | flags | int |
Facts
| 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.
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)// 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)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
);Related VEHICLE natives
- GET_VEHICLE_TRAILER_VEHICLE
- GET_DRIVER_OF_VEHICLE
- GET_LAST_DRIVEN_VEHICLE
- GET_LAST_PED_IN_VEHICLE_SEAT
- GET_PED_IN_VEHICLE_SEAT
- GET_POSITION_OF_VEHICLE_RECORDING_AT_TIME
- GET_ROTATION_OF_VEHICLE_RECORDING_AT_TIME
- GET_VEHICLE_BODY_HEALTH
- GET_VEHICLE_DOOR_LOCK_STATUS
- GET_VEHICLE_DOORS_LOCKED_FOR_PLAYER
- GET_VEHICLE_ENGINE_HEALTH
- GET_VEHICLE_ESTIMATED_MAX_SPEED
Facts compiled from community research (alloc8or/rdr3-nativedb-data, femga/rdr3_discoveries); descriptions and examples by The Lab.