[HELP] How to return a boat? (GetClosestVehicle)

GetClosestVehicle(currentPos.outside[1], currentPos.outside[2], currentPos.outside[3], 10.000, 0, 70)

It only works with cars and motorcycles.

I have been looking at Detecting Vehicles

but there doesn’t seem to be one for boats?

Are you sure? Did you try it?

Maybe this could help?

int GET_VEHICLE_CLASS(Vehicle vehicle) // 29439776AAA00A62 C025338E
Returns an int

Vehicle Classes:
0: Compacts
1: Sedans
2: SUVs
3: Coupes
4: Muscle
5: Sports Classics
6: Sports
7: Super
8: Motorcycles
9: Off-road
10: Industrial
11: Utility
12: Vans
13: Cycles
14: Boats
15: Helicopters
16: Planes
17: Service
18: Emergency
19: Military
20: Commercial
21: Trains

char buffer[128];
std::sprintf(buffer, "VEH_CLASS_%i", VEHICLE::GET_VEHICLE_CLASS(vehicle));

char* className = UI::_GET_LABEL_TEXT(buffer);

Do you know what the last 3 parameters are for GetClosestVehicle?

I know 3.000 is the radius, but how about last 2? is that why my boats wont work?

If you want to get boats you would have to change the flag (last number) from 70 to 12294, warning tho, the cars will then not work anymore, so what I’m advising you to do is the following:

local closecar = GetClosestVehicle(x, y, z, 4.0, 0, 71)

  if closecar == 0 then

    closecar = GetClosestVehicle(x, y, z, 4.0, 0, 12294)

  end

for delete Boat with GetClosetVehicle

GetClosestVehicle(x, y, z, radius, 0, 391551)

Also check this out: Served as my north star:

Judging by the working example in github, it looks like it works based on proximity to the CENTER of the vehicle! Sweet!