I’m writing a PDM script and I notice on a decent amount of cars GetClosestVehicle returns nothing, I saw in the documentation that this is a known thing. I was curious if ESX.Game.GetClosestVehicle is any different, and what does it return? The ESX documentation just shows the input.
Just wondering if it’s even worth the effort of ripping up my script to change everything to ESX.Game or if I need to find a different option.
Well my issue is some vehicles, for example most off road vehicles return 0. I’d have to cut like 30% of the vehicles from PDM because GetClosestVehicle returns 0 so I was looking into other options. I know there is casting a ray in front of a player to get a car, I use that for my repair resource, but it doesn’t really work for this situation. I need to get the car at specific coords even if the player isn’t near it or looking at it reliably.
This native can have some problems with some vehicles, that’s why he might wants to use the esx getclosestvehicle function (or atleast something based on it) (or check the snippet in the native ref for it)
After some playing around and debugging I found that it’s actually not GetClosestVehicle but what I was doing with the info that had the effect. Yesterday I was quite tired and just assumed GetClosestVehicle was the culprit because of the comments on the native.