Need help with finding multiple objects.
Where obj is I need it to be for a “models” list
//string[] models = { "prop_barrier_wat_03a", "prop_barrier_work05", "prop_mp_cone_01" };
var obj = "prop_barrier_wat_03a";
var closestEntity = API.GetClosestObjectOfType(LocalPedPos.X, LocalPedPos.Y, LocalPedPos.Z, 5f, (uint)API.GetHashKey(obj), false, true, true);
Hi,
the function wait for a hash, not a list. But if you want to get the closest with a list of type, you can simply use a for loop to get the distance and entity of each type, then get the closest one of them
1 Like
I marked this post for removal because it’s already been resolved. But thank you for the response it’s much appreciated.
Hummm,
Why do you what to remove the post? If you found a solution, share it here to help those who may have the same problem.
This forum is to share knowledge about FiveM
1 Like
I can’t post a fix to something that wasn’t fixed, it was replaced entirely so I marked it as solved. After speaking with a mod about the exact same thing I’m releasing the code publicly once it’s finished. I tried to have it removed before comments came in but that option isn’t available.